NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

USE [dbYapinetFast]
GO
/****** Object: StoredProcedure [dbo].[stpSirketKayit] Script Date: 07/31/2011 13:21:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[stpSirketKayit]
(
@SirketID NUMERIC(18,0) OUTPUT ,
@SirketKodu VARCHAR(20) OUTPUT,
@KisaUnvan VARCHAR(100),
@TamUnvan VARCHAR(150),
@Logo VARCHAR(50),
@Ulke VARCHAR(50),
@Sehir VARCHAR(50),
@Ilce VARCHAR(50),
@Adres VARCHAR(250),
@PostaKodu VARCHAR(10),
@Tel1 VARCHAR(50),
@Tel2 VARCHAR(50),
@Faks VARCHAR(50),
@Cep VARCHAR(50),
@Mail VARCHAR(50),
@VergiDaire VARCHAR(50),
@VergiNo VARCHAR(20),
@Yetkili VARCHAR(50),
@WebAdres VARCHAR(50),
@SirketTuru INT,
@UstSirket NUMERIC(18,0),
@ResimLokasyon VARCHAR(500),
@Op INT,
@Mesaj VARCHAR(250) OUTPUT
)
--WITH ENCRYPTION
AS

DECLARE @Durum INT
BEGIN TRAN
IF @Op=1
BEGIN
IF @SirketID=0
BEGIN

SELECT @SirketKodu=CONVERT(VARCHAR(10),Sayac + 1)
FROM tblKod
WHERE (Tur = 3)
UPDATE tblKod set Sayac=Sayac+1 WHERE Tur=3
IF @@ERROR<>0
BEGIN

SET @Mesaj='Şirket Kodu alınamadı ...'
GOTO HATA
END

IF EXISTS(SELECT * FROM tblSirket WHERE [SirketKodu]=@SirketKodu AND Durum=1)
BEGIN

SET @Mesaj='Şirket Kodu daha önce kullanılmış...'
GOTO HATA
END
SELECT @SirketID=count(*) from tblSirket

IF @SirketID > 1
BEGIN
INSERT INTO tblKod ( Tur, Harf, SayacBaslangic,Sayac, Aciklama,SirketRef)
(SELECT Tur, Harf, SayacBaslangic, SayacBaslangic, Aciklama,@SirketID
FROM tblKod where SirketRef=1)
IF @@ERROR<>0
BEGIN

SET @Mesaj='Şirket kaydı esnasında hata oluştu...'
GOTO HATA
END
END

INSERT INTO [dbo].[tblSirket](ID,[SirketKodu],[KisaUnvan] ,[TamUnvan],
[Ulke], [Sehir],[Ilce] , [Adres],[PostaKodu],[Tel1],[Tel2],[Faks],[Cep],
[Mail],[VergiDaire],[VergiNo] ,[Yetkili],[WebAddress],[SirketTuru],[UstSirket],ResimLokasyon)
VALUES
(@SirketID,@SirketKodu,@KisaUnvan,@TamUnvan,@Ulke,@Sehir,@Ilce,@Adres,@PostaKodu
,@Tel1,@Tel2,@Faks,@Cep,@Mail,@VergiDaire,@VergiNo,@Yetkili,@WebAdres
,@SirketTuru,@UstSirket,@ResimLokasyon)
IF @@ERROR<>0
BEGIN

SET @Mesaj='Şirket kaydı esnasında hata oluştu...'
GOTO HATA
END

-- SET @SirketID= @@IDENTITY

IF @Logo<>'0'
BEGIN
UPDATE tblSirket SET Logo=@SirketID WHERE ID=@SirketID
IF @@ERROR<>0
BEGIN

SET @Mesaj='Logo kaydedilirken hata oluştu...'
GOTO HATA
END
END

SET @Mesaj='Şirket Kaydedildi...'
GOTO BASARI
END
ELSE
BEGIN
IF EXISTS(SELECT * FROM tblSirket WHERE [SirketKodu]=@SirketKodu AND Durum=1 AND ID<>@SirketID)
BEGIN

SET @Mesaj='Şirket Kodu daha önce kullanılmış...'
GOTO HATA
END
UPDATE [dbo].[tblSirket] SET [SirketKodu]=@SirketKodu,[KisaUnvan]=@KisaUnvan
,[TamUnvan]=@TamUnvan,[Ulke]=@Ulke, [Sehir]=@Sehir,[Ilce]= @Ilce
,[Adres]=@Adres,[PostaKodu]=@PostaKodu,[Tel1]=@Tel1,[Tel2]=@Tel2
,[Faks]=@Faks,[Cep]=@Cep,[Mail]=@Mail,[VergiDaire]=@VergiDaire
,[VergiNo]=@VergiNo ,[Yetkili]=@Yetkili,[WebAddress]=@WebAdres
,[SirketTuru]=@SirketTuru,[UstSirket]= @UstSirket,[Durum]=1,
[GuncellemeTarihi]=getdate(),[SilmeTarihi]=null,
ResimLokasyon=@ResimLokasyon
WHERE ID=@SirketID
IF @@ERROR<>0
BEGIN

SET @Mesaj='Şirket güncelleniken hata oluştu...'
GOTO HATA
END



IF @Logo<>'0'
BEGIN
UPDATE tblSirket SET Logo=@SirketID WHERE ID=@SirketID
IF @@ERROR<>0
BEGIN

SET @Mesaj='Logo kaydedilirken hata oluştu...'
GOTO HATA
END
END
ELSE
BEGIN
UPDATE tblSirket SET Logo=@Logo WHERE ID=@SirketID
IF @@ERROR<>0
BEGIN

SET @Mesaj='Logo kaydedilirken hata oluştu...'
GOTO HATA
END
END

SET @Mesaj='Şirket güncellendi...'
GOTO BASARI
END
END
ELSE
BEGIN
---- BURAYA SİLİNMEMESİ İÇİN KONTROL İLAVE EDİLECEK
SELECT @Durum=Durum FROM tblSirket WHERE ID=@SirketID
IF @@ROWCOUNT=0
BEGIN

SET @Mesaj='Şirket bulunamadı...'
GOTO HATA
END

IF @Durum=0 SET @Durum=-1
IF @Durum=1 SET @Durum=0

UPDATE tblSirket SET Durum=@Durum ,SilmeTarihi=getdate() WHERE ID=@SirketID
IF @@ERROR<>0
BEGIN

SET @Mesaj='Şirket silinirken hata oluştu...'
GOTO HATA
END

SET @Mesaj='Şirket Silindi...'
GOTO BASARI
END






BASARI:
COMMIT TRAN
RETURN 0

HATA:
IF @@TRANCOUNT>1
BEGIN
COMMIT TRAN
RETURN -1
END
ELSE
BEGIN
ROLLBACK TRAN
RETURN -1
END
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.