public void LoadDocList(bool IsSearch) { dgvDoc.Rows.Clear(); string cmd = "SELECT Id,DocName,DocNo,IssueDate,ExpireDate,DocRenewComplate FROM Documents WHERE 1=1 "; if (DocTypeId != 0) { cmd += " AND DocTypeId =" + DocTypeId.ToString(); } if (IsSearch) { cmd += SetCondtionsSQL(); } DataTable dt = new DataTable(); if (Cv_Session.FillDataTable(dt, cmd)) { for (int x = 0; x < dt.Rows.Count; x++) { dgvDoc.Rows.Add(); dgvDoc.Rows[x].Tag = dt.Rows[x]["Id"].ToString(); dgvDoc.Rows[x].Cells["clmName"].Value = dt.Rows[x]["DocName"].ToString(); dgvDoc.Rows[x].Cells["clmNo"].Value = dt.Rows[x]["DocNo"].ToString(); dgvDoc.Rows[x].Cells["clmIssueDate"].Value = dt.Rows[x]["IssueDate"].ToString(); dgvDoc.Rows[x].Cells["clmExpireDate"].Value = dt.Rows[x]["ExpireDate"].ToString(); dgvDoc.Rows[x].Cells["clmRenew"].Value = dt.Rows[x]["DocRenewComplate"].ToString(); } } }
private void DisplayDocument() { string cmd = "SELECT Id,DocName,DocNo,IssueDate,ExpireDate FROM Documents WHERE Id=" + Cv_DocId; DataTable dt = new DataTable(); if (Cv_Session.FillDataTable(dt, cmd)) { if (dt.Rows.Count != 0) { txtDocName.Text = dt.Rows[0]["DocName"].ToString(); txtDocNo.Text = dt.Rows[0]["DocNo"].ToString(); dtpDateIssue.Value = DateTime.Parse(dt.Rows[0]["IssueDate"].ToString()); dtpDateExpire.Value = DateTime.Parse(dt.Rows[0]["ExpireDate"].ToString()); } } cmd = "SELECT DocPic FROM Documents WHERE Id=" + Cv_DocId; Cv_Session.LoadImageFromDb(picDoc, cmd); }
private void DisplayDate() { string cmd = " SELECT Id,UserName, UserPassword,StartOpenSystem,AlertByDayAfter FROM Users"; DataTable dt = new DataTable(); if (Cv_Session.FillDataTable(dt, cmd)) { if (dt.Rows.Count != 0) { txtUserName.Text = dt.Rows[0]["UserName"].ToString(); txtOldPassowrd.Text = dt.Rows[0]["UserPassword"].ToString(); ckhAlertIsOpen.Checked = bool.Parse(dt.Rows[0]["StartOpenSystem"].ToString()); txtDayAlert.Text = dt.Rows[0]["AlertByDayAfter"].ToString(); cmd = " SELECT Image FROM Users"; Cv_Session.LoadImageFromDb(picUser, cmd); } } }
public void LoadDocType(bool IsSearch) { pnlContent.Controls.Clear(); string cmd = "SELECT Id,Name,IconUrl FROM DocumentsType"; if (IsSearch) { if (!String.IsNullOrEmpty(txtSearch.Text)) { cmd += " WHERE Name LIKE '%" + txtSearch.Text + "%'"; } } DataTable dt = new DataTable(); if (!Cv_Session.FillDataTable(dt, cmd)) { return; } for (int i = 0; i < dt.Rows.Count; i++) { docTypeTitle = new MetroFramework.Controls.MetroTile(); docTypeTitle.Dock = System.Windows.Forms.DockStyle.Top; docTypeTitle.Size = new System.Drawing.Size(279, 77); docTypeTitle.Text = dt.Rows[i]["Name"].ToString(); cmd = "SELECT COUNT(Id) FROM Documents WHERE DocTypeId=" + dt.Rows[i]["Id"].ToString(); docTypeTitle.TileCount = int.Parse(Cv_Session.GetFieldText(cmd)); docTypeTitle.TileImage = Image.FromFile(dt.Rows[i]["IconUrl"].ToString()); docTypeTitle.TileImage.Tag = dt.Rows[i]["IconUrl"].ToString(); docTypeTitle.UseCustomBackColor = true; docTypeTitle.UseCustomForeColor = true; docTypeTitle.Tag = dt.Rows[i]["Id"]; docTypeTitle.UseSelectable = true; docTypeTitle.UseTileImage = true; docTypeTitle.Click += new System.EventHandler(this.docTypeSelect_Click); docTypeTitle.Name = "docTypeTitle" + i; this.pnlContent.Controls.Add(docTypeTitle); } }