Sayfayı Yazdır | Pencereyi Kapat

type

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=685
Tarih: 08 Ocak 2025 Saat 00:05
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: type
Mesajı Yazan: iremNisak
Konu: type
Mesaj Tarihi: 16 Temmuz 2024 Saat 17:29
var
  form: TCLForm;
  girdi, hosgeldiniz: TClProLabel;
  gidis: TClProButton;
  list: TCLProListView;
  DesignerPanel: TClProListViewDesignerPanel;
  EMPLOYEE_NAME, EMPLOYEE_ID, JOB_TITLE, EMPLOYEE_SURNAME: TClProLabel;
  query, query1: TClSqlQuery;
  status,selectedID: String;



void SetupSqlConnection;
{
  Clomosy.DBSQLServerConnect('SQL Server', '172.16.222.156', 'sa', 'irem1234', 'vardiyaa', 50000);
}

void AddDataToListview;
{
  query = TClSqlQuery.Create(nil);
  try
  
    query.Connection = Clomosy.DBSQLServerConnection;
    query.sql.text = 'SELECT ' +
      'kisi_id AS EMPLOYEE_ID, ' +
      'kisi_adi AS EMPLOYEE_NAME, ' +
      'kisi_soyad AS EMPLOYEE_SURNAME, ' +
      'kisi_meslegi AS JOB_TITLE, ' +
      'vardiya_baslangic AS SHIFT_START, ' +
      'vardiya_bitis AS SHIFT_END, ' +
      'dinlenme_bas AS REST_START, ' +
      'dinlenme_bitis AS REST_END ' +
      'FROM vardiyaa';
    query.Open;
    if (query.Found)
    {
      list.clLoadProListViewDataFromDataset(query);
    }
  
  except
  
    ShowMessage('1Exception Class: ' + LastExceptionClassName + ' Exception Message: ' + LastExceptionMessage);
  
  
    query.Free;
 } 
}

void CreateDesignerPanel;
{
  DesignerPanel = form.AddNewProListViewDesignerPanel(list, 'DesignerPanel');
  clComponent.SetupComponent(DesignerPanel, '{"Height":250,"Width" : 150,"BackgroundColor":"#F6EDDB","BorderColor":"#F5BCC9","BorderWidth":2,"RoundHeight":20,"RoundWidth":20}');
  list.SetDesignerPanel(DesignerPanel);
}

void CreateListView;
{
  list = form.AddNewProListView(form, 'list');
  list.Properties.ItemSpace = 10;
  clComponent.SetupComponent(list, '{"Height" : 150,"Align":"Client","MarginBottom":20,"MarginTop":20,"MarginRight":10,"MarginLeft":10, "ListType":"Cart","ItemColumnCount" : 2,"ItemHeight" : 160,"ItemWidth":160, "BorderColor":"#F5BCC9", "BorderWidth":2,"RoundWidth":5, "RoundHeight":5}');
  list.ListType = 'horizontal';
  form.AddNewEvent(list, tbeOnItemClick, 'onItemClicked');
}

void onItemClicked;
{
  try
  if (IntToStr(list.clSelectedItemData('clCaption')) <> '')
  {
    //ShowMessage(list.clSelectedItemData('Durum'));
    selectedID = IntToStr(list.clSelectedItemData('clCaption'));
   
    query1 = TClSqlQuery.Create(nil);
    
      query1.Connection = Clomosy.DBSQLServerConnection;
      query1.SQL.Text = 'DELETE FROM vardiyaa WHERE kisi_id = ' + selectedID;
      query1.ExecSQL;
      ShowMessage('Kayıt başarıyla silindi');
      AddDataToListview; // Listeyi güncelle
    
  }
  else
  {
    ShowMessage('Lütfen bir kayıt seçin');
  }
except

  ShowMessage('2Exception Class: ' + LastExceptionClassName + ' Exception Message: ' + LastExceptionMessage);

  query1.Free;
}
}

void CreateEMPLOYEE_NAMEAndPrice;
{
  EMPLOYEE_ID = form.AddNewProLabel(DesignerPanel, 'EMPLOYEE_ID', 'test');
  clComponent.SetupComponent(EMPLOYEE_ID, '{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Width":10,"Align" : "MostTop"}');
  DesignerPanel.AddPanelObject(EMPLOYEE_ID, clCaption);
  EMPLOYEE_ID.Properties.AutoSize = True;

  EMPLOYEE_NAME = form.AddNewProLabel(DesignerPanel, 'EMPLOYEE_NAME', 'test');
  clComponent.SetupComponent(EMPLOYEE_NAME, '{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
  DesignerPanel.AddPanelObject(EMPLOYEE_NAME, clText);
  EMPLOYEE_NAME.Properties.AutoSize = True;

  EMPLOYEE_SURNAME = form.AddNewProLabel(DesignerPanel, 'EMPLOYEE_SURNAME', 'test');
  clComponent.SetupComponent(EMPLOYEE_SURNAME, '{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
  DesignerPanel.AddPanelObject(EMPLOYEE_SURNAME, clText1);
  EMPLOYEE_SURNAME.Properties.AutoSize = True;

  JOB_TITLE = form.AddNewProLabel(DesignerPanel, 'JOB_TITLE', 'test');
  clComponent.SetupComponent(JOB_TITLE, '{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
  DesignerPanel.AddPanelObject(JOB_TITLE, clText2);
  JOB_TITLE.Properties.AutoSize = True;
}

{
  form = TCLForm.Create(self);
  form.SetFormColor('#b387e8', '', clGNone);

  CreateListView;
  SetupSqlConnection;
  CreateDesignerPanel;
  CreateEMPLOYEE_NAMEAndPrice;
  AddDataToListview;
  CallerForm.clShow;

  hosgeldiniz = form.AddNewproLabel(form, 'hosgeldiniz', 'Silmek İstediğiniz Kişiyi Seçiniz');
  clComponent.setupComponent(hosgeldiniz, '{"Align":"top","MarginsTop":70,"MarginsLeft":80,"MarginsRight":80,"Width":80,"Height":80,"TextColor":"#ad0154","TextSize":30,"TextVerticalAlign":"center","TextHorizontalAlign":"center","TextBold":"yes"}');

 /* gidis = form.AddNewProButton(form, 'gidis', 'TIKLAYINIZ');
  clComponent.setupComponent(gidis, '{"Align":"Mostbottom","Width":20,"Height":80,"MarginsTop":50,"MarginsBottom":20,"TextColor":"#c7237b","TextSize":25,"RoundHeight":250,"RoundWidth":250,"BorderColor":"#7A3E65","TextBold":"yes","BorderWidth":5}');
  form.AddNewEvent(gidis, tbeOnClick, 'GoToUnit1');
*/
  form.Run;
}




Cevaplar:
Mesajı Yazan: iremNisak
Mesaj Tarihi: 17 Temmuz 2024 Saat 15:10
could not convert variant of type(unicodeString) into type(Int64)
 hatası veriyor


Mesajı Yazan: Developer
Mesaj Tarihi: 17 Temmuz 2024 Saat 16:47
Merhaba İrem,
DELETE FROM vardiyaa WHERE kisi_id = ' + QuotedStr(selectedID)
birde bunu deneyebilir misiniz?


Mesajı Yazan: iremNisak
Mesaj Tarihi: 17 Temmuz 2024 Saat 17:05
Aynı hatayı veriyor


Mesajı Yazan: Developer
Mesaj Tarihi: 17 Temmuz 2024 Saat 17:45
Merhaba İrem 
selectedID = list.clSelectedItemData('clCaption'); bu satırı böyle değiştirebilir misin?


Mesajı Yazan: iremNisak
Mesaj Tarihi: 17 Temmuz 2024 Saat 18:05
Aynı hatayı veriyor hala


Mesajı Yazan: Developer
Mesaj Tarihi: 18 Temmuz 2024 Saat 09:23
Merhaba İrem 
Hata detayında satır numarası var mı?


Mesajı Yazan: iremNisak
Mesaj Tarihi: 18 Temmuz 2024 Saat 09:33



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net