public override void Review() { FishBll.Bll.PersonBll getnameBll = new FishBll.Bll.PersonBll(); FishEntity.PersonEntity getModel = new FishEntity.PersonEntity(); getModel = getnameBll.Getname(txtcreateman.Text); if (getModel != null) { Review(this.Name, txtNumbering.Text, getModel.username + " " + getModel.realname, txtcode.Text); //if ( txtNumbering . Text != "" ) //{ // _Refreshbll = new FishBll . Bll . ProcessStateBll ( ); // _Refreshbll . GetFormCargoFeedbackSheet ( txtNumbering . Text ); //} } base.Review(); }
void tmiRole_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow == null) { return; } FishEntity.PersonEntity person = dataGridView1.CurrentRow.DataBoundItem as FishEntity.PersonEntity; if (person == null) { return; } FormUserRole form = new FormUserRole(person); form.ShowDialog(); }
protected void SelectMan(TextBox txt) { FormUserList form = new FormUserList(true); form.StartPosition = FormStartPosition.CenterParent; form.ShowInTaskbar = false; DialogResult result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { FishEntity.PersonEntity person = form.SelectedPersion; if (person != null) { txt.Text = person.realname; txt.Tag = person.id; } } }
private void btnOk_Click(object sender, EventArgs e) { lblTipInfo.Visible = lblTipPwd.Visible = lblTipUser.Visible = false; bool isOk = true; if (string.IsNullOrEmpty(txtUserName.Text)) { lblTipUser.Text = "请输入用户名"; lblTipUser.Visible = true; isOk = false; txtUserName.Focus(); } if (string.IsNullOrEmpty(txtPassword.Text)) { lblTipPwd.Text = "请输入密码"; lblTipPwd.Visible = true; isOk = false; txtPassword.Focus(); } if (isOk == false) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } string username = txtUserName.Text.Trim(); string password = txtPassword.Text; string pwdMD5 = Utility.DesEncryptUtil.EncryptMD5(password); FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); FishEntity.PersonEntity entity = bll.Login(username, pwdMD5); if (entity == null) { this.DialogResult = System.Windows.Forms.DialogResult.None; lblTipInfo.Text = "登录失败,用户名或密码错误"; lblTipInfo.Visible = true; } FishEntity.Variable.User = entity; SaveUser(entity); }
public void User( ) { FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll( ); List <FishEntity.PersonEntity> list1 = bll.id_name( ); if (list1 == null) { list1 = new List <FishEntity.PersonEntity> ( ); } FishEntity.PersonEntity tmep = new FishEntity.PersonEntity( ); tmep.id = 0; tmep.username = "******"; list1.Insert(0, tmep); cmbCodeNumUser.DataSource = list1; cmbCodeNumUser.DisplayMember = "username"; cmbCodeNumUser.ValueMember = "username"; }
public List <FishEntity.PersonEntity> DataTableToList_name(DataTable dt) { List <FishEntity.PersonEntity> modelList = new List <FishEntity.PersonEntity>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { FishEntity.PersonEntity model; for (int n = 0; n < rowsCount; n++) { model = new FishEntity.PersonEntity(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.username = dt.Rows[n]["username"].ToString(); modelList.Add(model); } } return(modelList); }
public override int Modify() { //return base.Modify(); if (dataGridView1.CurrentRow == null) { MessageBox.Show("请选择要编辑的行"); return(0); } FishEntity.PersonEntity entity = dataGridView1.CurrentRow.DataBoundItem as FishEntity.PersonEntity; if (entity == null) { MessageBox.Show("请选择要编辑的行"); return(0); } FormUser form = new FormUser("编辑数据", entity); form.StartPosition = FormStartPosition.CenterParent; form.ShowInTaskbar = false; form.RefreshEvent += form_RefreshEvent; form.ShowDialog(); return(0); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FishEntity.PersonEntity model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(FishEntity.PersonEntity model) { return(dal.Add(model)); }
/// <summary> /// 分页获取数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} #endregion Method public FishEntity.PersonEntity Login(string userName, string password) { FishEntity.PersonEntity entity = dal.Login(userName, password); return(entity); }
/// <summary> /// 获得数据列表 /// </summary> public List <FishEntity.PersonEntity> DataTableToList(DataTable dt) { List <FishEntity.PersonEntity> modelList = new List <FishEntity.PersonEntity>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { FishEntity.PersonEntity model; for (int n = 0; n < rowsCount; n++) { model = new FishEntity.PersonEntity(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.username = dt.Rows[n]["username"].ToString(); model.password = dt.Rows[n]["password"].ToString(); model.realname = dt.Rows[n]["realname"].ToString(); model.ename = dt.Rows[n]["ename"].ToString(); model.sex = dt.Rows[n]["sex"].ToString(); model.email = dt.Rows[n]["email"].ToString(); model.phone = dt.Rows[n]["phone"].ToString(); model.telephone = dt.Rows[n]["telephone"].ToString(); if (dt.Rows[n]["age"].ToString() != "") { model.age = int.Parse(dt.Rows[n]["age"].ToString()); } model.department = dt.Rows[n]["department"].ToString(); if (dt.Rows[0]["entrytime"] != null && dt.Rows[0]["entrytime"].ToString() != "") { model.entrytime = DateTime.Parse(dt.Rows[n]["entrytime"].ToString()); } model.roletype = dt.Rows[n]["roletype"].ToString(); model.roledate = dt.Rows[n]["roledate"].ToString(); if (dt.Rows[0]["createtime"] != null && dt.Rows[0]["createtime"].ToString() != "") { model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString()); } model.createman = dt.Rows[n]["createman"].ToString(); if (dt.Rows[0]["modifytime"] != null && dt.Rows[0]["modifytime"].ToString() != "") { model.modifytime = DateTime.Parse(dt.Rows[n]["modifytime"].ToString()); } model.modifyman = dt.Rows[n]["modifyman"].ToString(); if (dt.Rows[n]["isdelete"].ToString() != "") { model.isdelete = int.Parse(dt.Rows[n]["isdelete"].ToString()); } if (dt.Rows [n] ["Selection"].ToString( ) != "") { if (dt.Rows [n] ["Selection"].ToString( ).Equals("0")) { model.Selection = false; } else { model.Selection = true; } } modelList.Add(model); } } return(modelList); }
public FormLogin() { InitializeComponent(); label1.BackColor = Color.Transparent; label2.BackColor = Color.Transparent; tcCheckBox1.BackColor = Color.Transparent; lblTipInfo.BackColor = Color.Transparent; lblTipPwd.BackColor = Color.Transparent; lblTipUser.BackColor = Color.Transparent; btnOk.DrawType = UILibrary.DrawStyle.Img; btnCancel.DrawType = UILibrary.DrawStyle.Img; //string imagePath = Application.StartupPath + "\\Images\\blue_button_normal.png"; //if (File.Exists(imagePath)) //{ // btnOk.NormlBack = Image.FromFile(imagePath); //} //string downPath = Application.StartupPath + "\\Images\\blue_button_down.png"; //if (File.Exists(downPath)) //{ // btnOk.DownBack = Image.FromFile(downPath); //} //string hoverPath = Application.StartupPath + "\\Images\\blue_button_hover.png"; //if (File.Exists(downPath)) //{ // btnOk.MouseBack = Image.FromFile(downPath); //} SetButtomImage(btnOk); SetButtomImageGray(btnCancel); //imagePath = Application.StartupPath + "\\Images\\gray_button_normal.png"; //if (File.Exists(imagePath)) //{ // btnCancel.NormlBack = Image.FromFile(imagePath); //} //downPath = Application.StartupPath + "\\Images\\gray_button_down.png"; //if (File.Exists(downPath)) //{ // btnCancel.DownBack = Image.FromFile(downPath); //} //hoverPath = Application.StartupPath + "\\Images\\gray_button_hover.png"; //if (File.Exists(downPath)) //{ // btnCancel.MouseBack = Image.FromFile(downPath); //} //string logoPath = Application.StartupPath + "\\Images\\logo.jpg"; //if (File.Exists(logoPath)) //{ // pictureBox1.Image = Image.FromFile(logoPath); //} //string bgPath = Application.StartupPath + "\\Images\\bg.png"; //if (File.Exists(bgPath)) //{ // this.BackgroundImage = Image.FromFile(bgPath); //} //string ipath = Application.StartupPath + "\\Images\\btn_mini_down.png"; //if (File.Exists(ipath)) //{ // this.MiniDownBack = Image.FromFile(ipath); //} //ipath = Application.StartupPath + "\\Images\\btn_mini_hover.png"; //if (File.Exists(ipath)) //{ // this.MiniMouseBack = Image.FromFile(ipath); //} //ipath = Application.StartupPath + "\\Images\\btn_mini_normal.png"; //if (File.Exists(ipath)) //{ // this.MiniNormlBack = Image.FromFile(ipath); //} //ipath = Application.StartupPath + "\\Images\\close_btn_down.png"; //if (File.Exists(ipath)) //{ // this.CloseDownBack = Image.FromFile(ipath); //} //ipath = Application.StartupPath + "\\Images\\close_btn_hover.png"; //if (File.Exists(ipath)) //{ // this.CloseMouseBack = Image.FromFile(ipath); //} //ipath = Application.StartupPath + "\\Images\\close_btn_normal.png"; //if (File.Exists(ipath)) //{ // this.CloseNormlBack = Image.FromFile(ipath); //} lblTipPwd.Visible = false; lblTipUser.Visible = false; lblTipInfo.Visible = false; lblTipUser.Text = lblTipPwd.Text = lblTipInfo.Text = string.Empty; FishEntity.PersonEntity u = UserManager.LoadUsers(); if (u != null) { txtUserName.Text = u.username; } }
public FormCallRecordsTable() { InitializeComponent(); menuStrip1.Items.Remove(tmiQuery); menuStrip1.Items.Remove(tmiAdd); menuStrip1.Items.Remove(tmiModify); menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiQuery); menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiAdd); menuStrip1.Items.Insert(menuStrip1.Items.IndexOf(tmiClose), tmiModify); ReadColumnConfig(dataGridView1, "Set_CallRecordsTable_1"); //ReadColumnConfig(dataGridView2, "Set_CallRecordsTable_2"); cmbProvince.SelectedValueChanged -= cmbProvince_SelectedValueChanged; InitDataUtil.BindComboBoxData(cmbProvince, FishEntity.Constant.Province, true); cmbProvince.SelectedValueChanged += cmbProvince_SelectedValueChanged; BindArea(); BindCustomerType(FishEntity.Constant.Type); BindHZHB(); List <FishEntity.DictEntity> list = InitDataUtil.DictList.FindAll((i) => { return(i.pcode.Equals(FishEntity.Constant.Paymethod)); }); if (list == null) { list = new List <FishEntity.DictEntity>(); } FishEntity.DictEntity empty = new FishEntity.DictEntity(); empty.name = ""; empty.code = "-1"; list.Insert(0, empty); cmbPayMethod.DataSource = list; cmbPayMethod.DisplayMember = "name"; cmbPayMethod.ValueMember = "code"; if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan)) { cmbTheperson.Enabled = false; cmbTheperson.Visible = false; label12.Visible = false; } FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); List <FishEntity.PersonEntity> list1 = bll.id_name(); if (list1 == null) { list1 = new List <FishEntity.PersonEntity>(); } FishEntity.PersonEntity tmep = new FishEntity.PersonEntity(); tmep.username = "******"; list1.Insert(0, tmep); cmbTheperson.DataSource = list1; cmbTheperson.DisplayMember = "username"; cmbTheperson.ValueMember = "username"; }
private void btnOk_Click(object sender, EventArgs e) { if (Check() == false) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } bool isAdd = false; if (_person == null) { string username = txtUserName.Text.Trim(); FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); if (bll.Exists(username)) { MessageBox.Show("用户名已经存在,请使用其他名称。"); txtUserName.SelectAll(); txtUserName.Focus(); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } _person = new FishEntity.PersonEntity(); _person.isdelete = 0; isAdd = true; _person.password = Utility.DesEncryptUtil.EncryptMD5("123456"); _person.createman = FishEntity.Variable.User.username; _person.createtime = DateTime.Now; _person.modifyman = _person.createman; _person.modifytime = _person.createtime; } else { string username = txtUserName.Text.Trim(); if (_person.username.Equals(username) == false) { FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); if (bll.Exists(username)) { MessageBox.Show("用户名已经存在,请使用其他名称。"); txtUserName.SelectAll(); txtUserName.Focus(); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } } _person.modifyman = FishEntity.Variable.User.username; _person.modifytime = DateTime.Now; } int temp = 0; int.TryParse(txtAge.Text, out temp); _person.age = temp; _person.department = txtdepartment.Text; _person.email = txtemail.Text; _person.ename = txtEname.Text; _person.entrytime = dtpEntryDate.Value; _person.phone = txtphone.Text; _person.realname = txtRealName.Text; _person.roledate = string.Empty; string role = string.Empty; if (cbsalesman.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbsalesman.Text; } if (cbsalesmanger.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbsalesmanger.Text; } if (ckadmin.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += ckadmin.Text; } if (cbFinance.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbFinance.Text; } if (cbFinancialOfficer.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbFinancialOfficer.Text; } if (cbLogisticsStaff.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbLogisticsStaff.Text; } if (cbLogisticsDirector.Checked) { if (string.IsNullOrEmpty(role) == false) { role += ","; } role += cbLogisticsDirector.Text; } _person.roletype = role; _person.sex = rbman.Checked ? "男":"女"; _person.telephone = txtTelephone.Text; _person.username = txtUserName.Text; if (isAdd) { FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); bool isok = bll.Add(_person); if (isok) { OnRefresh(); } } else { FishBll.Bll.PersonBll bll = new FishBll.Bll.PersonBll(); bool isok = bll.Update(_person); if (isok) { OnRefresh(); } } }
public FishEntity.PersonEntity Login(string userName, string password) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,username,password,realname,ename,sex,email,phone,telephone,age,department,entrytime,roletype,roledate,createtime,createman,modifytime,modifyman,isdelete from t_user "); strSql.Append(" where username=@username and password=@password and isdelete=0"); MySqlParameter[] parameters = { new MySqlParameter("@username", MySqlDbType.VarChar, 45), new MySqlParameter("@password", MySqlDbType.VarChar) }; parameters[0].Value = userName; parameters[1].Value = password; FishEntity.PersonEntity model = new FishEntity.PersonEntity(); DataSet ds = MySqlHelper.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.username = ds.Tables[0].Rows[0]["username"].ToString(); model.password = ds.Tables[0].Rows[0]["password"].ToString(); model.realname = ds.Tables[0].Rows[0]["realname"].ToString(); model.ename = ds.Tables[0].Rows[0]["ename"].ToString(); model.sex = ds.Tables[0].Rows[0]["sex"].ToString(); model.email = ds.Tables[0].Rows[0]["email"].ToString(); model.phone = ds.Tables[0].Rows[0]["phone"].ToString(); model.telephone = ds.Tables[0].Rows[0]["telephone"].ToString(); if (ds.Tables[0].Rows[0]["age"].ToString() != "") { model.age = int.Parse(ds.Tables[0].Rows[0]["age"].ToString()); } model.department = ds.Tables[0].Rows[0]["department"].ToString(); if (ds.Tables[0].Rows[0]["entrytime"] != null && ds.Tables[0].Rows[0]["entrytime"].ToString() != "") { model.entrytime = DateTime.Parse(ds.Tables[0].Rows[0]["entrytime"].ToString()); } model.roletype = ds.Tables[0].Rows[0]["roletype"].ToString(); model.roledate = ds.Tables[0].Rows[0]["roledate"].ToString(); if (ds.Tables[0].Rows[0]["createtime"] != null && ds.Tables[0].Rows[0]["createtime"].ToString() != "") { model.createtime = DateTime.Parse(ds.Tables[0].Rows[0]["createtime"].ToString()); } model.createman = ds.Tables[0].Rows[0]["createman"].ToString(); if (ds.Tables[0].Rows[0]["modifytime"] != null && ds.Tables[0].Rows[0]["modifytime"].ToString() != "") { model.modifytime = DateTime.Parse(ds.Tables[0].Rows[0]["modifytime"].ToString()); } model.modifyman = ds.Tables[0].Rows[0]["modifyman"].ToString(); if (ds.Tables[0].Rows[0]["isdelete"].ToString() != "") { model.isdelete = int.Parse(ds.Tables[0].Rows[0]["isdelete"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FishEntity.PersonEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_user set "); strSql.Append("username=@username,"); strSql.Append("password=@password,"); strSql.Append("realname=@realname,"); strSql.Append("ename=@ename,"); strSql.Append("sex=@sex,"); strSql.Append("email=@email,"); strSql.Append("phone=@phone,"); strSql.Append("telephone=@telephone,"); strSql.Append("age=@age,"); strSql.Append("department=@department,"); strSql.Append("entrytime=@entrytime,"); strSql.Append("roletype=@roletype,"); strSql.Append("roledate=@roledate,"); strSql.Append("createtime=@createtime,"); strSql.Append("createman=@createman,"); strSql.Append("modifytime=@modifytime,"); strSql.Append("modifyman=@modifyman,"); strSql.Append("isdelete=@isdelete"); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32, 11), new MySqlParameter("@username", MySqlDbType.VarChar, 45), new MySqlParameter("@password", MySqlDbType.VarChar, 45), new MySqlParameter("@realname", MySqlDbType.VarChar, 45), new MySqlParameter("@ename", MySqlDbType.VarChar, 45), new MySqlParameter("@sex", MySqlDbType.VarChar, 45), new MySqlParameter("@email", MySqlDbType.VarChar, 100), new MySqlParameter("@phone", MySqlDbType.VarChar, 45), new MySqlParameter("@telephone", MySqlDbType.VarChar, 45), new MySqlParameter("@age", MySqlDbType.Int32, 11), new MySqlParameter("@department", MySqlDbType.VarChar, 45), new MySqlParameter("@entrytime", MySqlDbType.Timestamp), new MySqlParameter("@roletype", MySqlDbType.VarChar, 45), new MySqlParameter("@roledate", MySqlDbType.VarChar, 500), new MySqlParameter("@createtime", MySqlDbType.Timestamp), new MySqlParameter("@createman", MySqlDbType.VarChar, 45), new MySqlParameter("@modifytime", MySqlDbType.Timestamp), new MySqlParameter("@modifyman", MySqlDbType.VarChar, 45), new MySqlParameter("@isdelete", MySqlDbType.Int32, 6) }; parameters[0].Value = model.id; parameters[1].Value = model.username; parameters[2].Value = model.password; parameters[3].Value = model.realname; parameters[4].Value = model.ename; parameters[5].Value = model.sex; parameters[6].Value = model.email; parameters[7].Value = model.phone; parameters[8].Value = model.telephone; parameters[9].Value = model.age; parameters[10].Value = model.department; parameters[11].Value = model.entrytime; parameters[12].Value = model.roletype; parameters[13].Value = model.roledate; parameters[14].Value = model.createtime; parameters[15].Value = model.createman; parameters[16].Value = model.modifytime; parameters[17].Value = model.modifyman; parameters[18].Value = model.isdelete; int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }