internal void UpdateItem(Workstation wupdate) { BWorkstation workstation = new BWorkstation(); dgrWorkstation["colCode", currentRow].Value = wupdate.WorkstationCode; dgrWorkstation["colName", currentRow].Value = wupdate.Name; dgrWorkstation["colIP", currentRow].Value = wupdate.IPAddress; dgrWorkstation["colUinitManager", currentRow].Value = wupdate.UnitManager; dgrWorkstation["colUniManagerTel", currentRow].Value = wupdate.PhoneNumber; dgrWorkstation["colAddress", currentRow].Value = wupdate.Address; dgrWorkstation["colAdminManger", currentRow].Value = wupdate.AdminName; dgrWorkstation["colAdminManagerTel", currentRow].Value = wupdate.AdminPhone; }
internal void AddItem(Workstation wupdate) { BWorkstation workstation = new BWorkstation(); DataRow newRow = ds.Tables[0].NewRow(); currentRow = dgrWorkstation.Rows.Count + 1; newRow["STT"] = currentRow; newRow["WORKSTATION_ID"] = wupdate.WorkstationId; newRow["CODE"] = wupdate.WorkstationCode; newRow["NAME"] = wupdate.Name; newRow["IP"] = wupdate.IPAddress; newRow["UNIT_MANAGER"] = wupdate.UnitManager; newRow["TEL"] = wupdate.PhoneNumber; newRow["ADDRESS"] = wupdate.Address; newRow["ADMIN_NAME"] = wupdate.AdminName; newRow["ADMIN_TEL"] = wupdate.AdminPhone; ds.Tables[0].Rows.Add(newRow); }
private void DeleteRowsSelected() { int workstationId = (int)dgrWorkstation["colID",currentRow].Value; BWorkstation bw = new BWorkstation(); Workstation w = new Workstation(workstationId); try { bool ret = bw.Delete(w); } catch (Exception exp) { MsgBoxVN.ShowError(exp.Message,Dic.STRING_WARNING); } }
private void SaveUpdate() { BWorkstation update = new BWorkstation(); wupdate.WorkstationCode = txtCode.Text; wupdate.Name = txtName.Text; wupdate.Address = txtAddress.Text; wupdate.IPAddress = txtIP.Text; wupdate.UnitManager = txtUnitManager.Text; wupdate.Address = txtAddress.Text; wupdate.PhoneNumber = txtTel.Text; wupdate.AdminName = txtAdminManager.Text; wupdate.AdminPhone = txtAdminTel.Text; wupdate.AreaId = (int)cboArea.SelectedValue; if (!txtPassword.Text.Equals("QTC-ADVERTISE")) wupdate.Password = MD5.EncryptionToString(txtPassword.Text.Trim()); if (MsgBoxVN.ShowConfirm(InternalGlobal.UPDATE_QUESTION_MSG,InternalGlobal.UPDATE_QUESTION_CAPTION)) { try { update.Update(wupdate); Dispose(); frmWorkstation.UpdateItem(wupdate); } catch (SqlException exp) { if(exp.Number ==2627) MsgBoxVN.ShowError("Mã máy trạm đã tồn tại.","Thông báo"); else MsgBoxVN.ShowError("Có lỗi trong quá trình cập nhật.\n\nLỗi ---> " + exp.Message, "Thông báo"); } } }
private void SaveNew() { BWorkstation newWT = new BWorkstation(); Workstation data = new Workstation(txtCode.Text, txtName.Text, MD5.EncryptionToString(txtPassword.Text.Trim()), txtIP.Text, txtUnitManager.Text, txtAddress.Text, txtTel.Text, txtAdminManager.Text, txtAdminTel.Text, (int)cboArea.SelectedValue); try { data.WorkstationId = newWT.Add(data); frmWorkstation.AddItem(data); ClearFields(); } catch (SqlException exp) { if(exp.Number ==2627) MsgBoxVN.ShowError("Mã máy trạm đã tồn tại.","Thông báo"); else MsgBoxVN.ShowError("Có lỗi trong quá trình cập nhật.\n\nLỗi ---> " + exp.Message, "Thông báo"); return; } }
/// <summary> /// @author : khoaht /// @createDate : 14/7/2009 /// </summary> /// <param name="code"></param> private void WriteLoginLog(string code) { try { BWorkstation bw = new BWorkstation(); DataRow dr = BWorkstation.SearchCode(code).Tables[0].Rows[0]; Workstation mw = new Workstation(); mw.WorkstationId = (int)dr["WORKSTATION_ID"]; mw.WorkstationCode = (string)dr["CODE"]; mw.Name = (string)dr["NAME"]; mw.Password = (string)dr["PASSWORD"]; mw.IPAddress = (string)dr["IP"]; mw.UnitManager = (string)dr["UNIT_MANAGER"]; mw.Address = (string)dr["ADDRESS"]; mw.PhoneNumber = (string)dr["TEL"]; mw.AdminName = (string)dr["ADMIN_NAME"]; mw.AdminPhone = (string)dr["ADMIN_TEL"]; mw.AreaId = (int)dr["AREA_ID"]; mw.Status = (byte)1; mw.LogTime = DateTime.Now; bw.UpdateLog(mw); } catch { } }
public static bool Login(string pstrWorkstationCode, string pstrPasswordEngcypt, bool pblnSaveInfo) { bool blnLogin=false; try { Logout(); mWorkstation = new QTC.Adv.DataModule.Single.Workstation(); mWorkstation.WorkstationId = -1; mWorkstation.WorkstationCode = pstrWorkstationCode.Trim(); mWorkstation.Password = Qtc.Libs.Security.MD5.EncryptionToString(pstrPasswordEngcypt); BWorkstation bWorkstation = new BWorkstation(); blnLogin = bWorkstation.Login(mWorkstation); // Load FTP info QTC.Adv.BusinessModule.Global.LoadPropertiesInfo(); if (pblnSaveInfo) { Properties.Settings.Default.UserName = pstrWorkstationCode; Properties.Settings.Default.Password = pstrPasswordEngcypt; Properties.Settings.Default.SaveInfo = pblnSaveInfo; Properties.Settings.Default.WorkstationId = mWorkstation.WorkstationId; Properties.Settings.Default.Save(); } else { Properties.Settings.Default.UserName = ""; Properties.Settings.Default.Password = ""; Properties.Settings.Default.SaveInfo = pblnSaveInfo; Properties.Settings.Default.Save(); } } catch (Exception) { return false; } return blnLogin; }