void AuthControl(string desc, AtlasForm form) { sysDb.parameterDelete(); sysDb.AddParameterValue("@desc", desc); sysDb.AddParameterValue("@authRef", authRef); DataTable dtAuth = sysDb.GetDataSet(@"SELECT SysAuths.Ref AS authRef,sysMenu.code, sysMenu.description, sysAuthDetails.authSee, sysAuthDetails.authAdd, sysAuthDetails.authUpdate, sysAuthDetails.authShow FROM SysAuths INNER JOIN sysAuthDetails ON SysAuths.Ref = sysAuthDetails.authRef INNER JOIN sysMenu ON sysAuthDetails.menuRef = sysMenu.Ref where description=@desc and authRef=@authRef").Tables[0]; form._add = bool.Parse(dtAuth.Rows[0]["authAdd"].ToString()); form._update = bool.Parse(dtAuth.Rows[0]["authUpdate"].ToString()); form._show = bool.Parse(dtAuth.Rows[0]["authShow"].ToString()); }
public void GetCode(string tabloadi, string alan, AtlasForm form, AtlasButtonEdit btn, int start) { int code = 0; System.Data.DataTable dt = db.GetDataSet("select " + alan + " from " + tabloadi).Tables[0]; if (dt.Rows.Count >= 1) { code = int.Parse(db.GetScalarValue("select MAX(" + alan + ") from " + tabloadi).ToString()); code++; } else { code = start; code++; } btn.Enabled = false; btn.SetString(code.ToString()); }
private void Calculate(object sender, EventArgs e) { int haftaSonu = 0, resmiTatil = 0, diniTatil = 0; DateTime tarih1 = dtpIzinBaslangic.GetDate(); DateTime tarih2 = dtpIzinBitisTarihi.GetDate(); for (DateTime date = tarih1; date <= tarih2; date = date.AddDays(1)) { if (date.DayOfWeek == DayOfWeek.Sunday) { haftaSonu++; } if (date.DayOfYear == 1 || date.DayOfYear == 113 || date.DayOfYear == 121 || date.DayOfYear == 139 || date.DayOfYear == 196 || date.DayOfYear == 242 || date.DayOfYear == 301) { resmiTatil++; } } DataTable dtDini = db.GetDataSet("SELECT * FROM tbReligion").Tables[0]; for (int a = 0; a < dtDini.Rows.Count; a++) { for (DateTime date = tarih1; date < tarih2; date = date.AddDays(1)) { if (date >= DateTime.Parse(dtDini.Rows[a][2].ToString()) && date <= DateTime.Parse(dtDini.Rows[a][3].ToString())) { if (date.DayOfWeek != DayOfWeek.Sunday) { if (date.DayOfYear != 1 && date.DayOfYear != 113 && date.DayOfYear != 121 && date.DayOfYear != 139 && date.DayOfYear != 196 && date.DayOfYear != 242 && date.DayOfYear != 301) { diniTatil++; } } } } } DateTime tarih3 = dtpIseBaslamaTarihi.GetDate(); TimeSpan Sonuc = tarih2 - tarih1; txtTalepEdilen.SetString((Sonuc.TotalDays + 1).ToString()); txtIstenilen.SetString((Sonuc.TotalDays + 1).ToString()); txtHaftaSonu.SetString(haftaSonu.ToString()); txtDiniBayram.SetString(diniTatil.ToString()); txtMilli.SetString(resmiTatil.ToString()); txtTotal.SetString((resmiTatil + diniTatil + haftaSonu).ToString()); txtToplamTatil.SetString(txtTotal.GetString()); dtpIseBaslamaTarihi.flashDate.Properties.MinValue = dtpIzinBitisTarihi.GetDate().AddDays(1); dtpIseBaslamaTarihi.SetDate(dtpIzinBitisTarihi.GetDate().AddDays(1)); }
private void btnLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ledFirm.GetValue().ToString())) { if (string.IsNullOrEmpty(txtUsername.GetString())) { XtraMessageBox.Show("Kullanıcı adı boş geçilemez.", "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrEmpty(txtPassword.GetString())) { XtraMessageBox.Show("Şifre boş geçilemez.", "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string hashedPass = helper.TextSifrele(txtPassword.GetString()); db.AddParameterValue("@param1", txtUsername.GetString()); db.AddParameterValue("@param2", hashedPass); if (db.GetDataSet("select * from sysUser where userName=@param1 and password=@param2").Tables[0].Rows.Count > 0) { FrmErpMain main = (FrmErpMain)Application.OpenForms["FrmErpMain"]; db.AddParameterValue("@param1", txtUsername.GetString()); db.AddParameterValue("@param2", hashedPass); main.userRef = int.Parse(db.GetScalarValue("select Ref from sysUser where userName=@param1 and password=@param2").ToString()); main.firmRef = ledFirm.GetValue(); this.DialogResult = DialogResult.OK; } else { Titret(); } } } else { XtraMessageBox.Show("Firma seçmeden giriş yapamazsınız.", "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }