void BindData() { if (id > 0) { SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(id); this.textBox1.Text = userEnt.Loginname; this.textBox2.Text = userEnt.Pwd; switch (userEnt.Groupid) { case 1: this.radioButton1.Checked = true; break; case 2: this.radioButton2.Checked = true; break; case 3: this.radioButton3.Checked = true; break; case 4: this.radioButton4.Checked = true; break; default: break; } } }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> public int CenterLanZhi_Remove(Int32 id) { Int32 ijg = 0; String strValue = this.CenterLanZhi; if (String.IsNullOrEmpty(strValue) == false && ("," + strValue + ",").Contains("," + id + ",") == true) { strValue = ("," + strValue + ",").Replace("," + id + ",", ",").Trim(','); SR_UserEntity ent = DataBase.Instance.tSR_User.Get_Entity(Param.UserId); ent.Remark = strValue; DataBase.Instance.tSR_User.Update(ent); ijg = 1; } return(ijg); }
private void button1_Click(object sender, EventArgs e) { DataBase.Instance.tSR_Systemrecord.Add(new SR_SystemrecordEntity() { Adddate = DateTime.Now, Ltype = "日志", Title = Param.Loginname, Description = DataBase.Instance.tSR_User.Get_Entity(Param.UserId) == null ? "" : DataBase.Instance.tSR_User.Get_Entity(Param.UserId).Loginname + "密码设置", Remark = "设置" }); if (this.textBox1.Text.Length != 6 || this.textBox2.Text.Length != 6 || this.textBox3.Text.Length != 6) { new SRFMessageBox("密码必须为6个ASCII字符!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(Param.UserId); if (this.textBox1.Text.Equals(userEnt.Pwd) == false) { new SRFMessageBox("旧密码输入错误!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (this.textBox2.Text.Equals(this.textBox3.Text) == false) { new SRFMessageBox("新密码不一致!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } userEnt.Pwd = this.textBox2.Text; if (DataBase.Instance.tSR_User.Update(userEnt) > 0) { if (new SRFMessageBox("密码修改成功,请牢记新密码!", "提示", MessageBoxButtons.OK).ShowDialog() == DialogResult.OK) { this.ParentForm.Close(); } } else { new SRFMessageBox("修改失败!", "提示", MessageBoxButtons.OK).ShowDialog(); } }
private void 制到指定目录ToolStripMenuItem_Click(object sender, EventArgs e) { SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(Param.UserId); if (userEnt == null || String.IsNullOrEmpty(userEnt.Companyname) == true) { MessageBox.Show("未设置路径!"); return; } using (new IdentityScope(Param.ServerIP.Description, Param.ServerIP.Remark, Param.ServerIP.Title)) { SRRC_ResourceEntity item = DataBase.Instance.tSRRC_Resource.Get_Entity(this.PicId); if (item == null) { return; } string path = ""; if (item.Iscomposite)//复合文件 { var temp = DataBase.Instance.tSRRC_Resource.Get_Entity(item.Pid); path = temp.Serverip + temp.Path; } else { path = item.Serverip + item.Path; } SROperation2.Instance.isLoading = true; int totalCount = 0; if (Directory.Exists(path)) {//文件夹 totalCount += Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Length; } else if (File.Exists(path)) { //文件 totalCount++; } SROperation2.Instance.entListCount = totalCount; SROperation2.Instance.entListReadyCount = 0; Thread t = new Thread(new ThreadStart(SetWaitPic)); t.Start(); //先复制文件 if (Directory.Exists(path)) {//文件夹 string destPath = userEnt.Companyname.TrimEnd('\\') + "\\" + new DirectoryInfo(path).Name; if (!Directory.Exists(destPath)) { Directory.CreateDirectory(destPath); } else { Directory.Delete(destPath, true); Directory.CreateDirectory(destPath); } this.copyDirectory(path, destPath); } else if (File.Exists(path)) { //文件 File.Copy(path, userEnt.Companyname.TrimEnd('\\') + "\\" + new FileInfo(path).Name, true); ++SROperation2.Instance.entListReadyCount; } } SROperation2.Instance.isLoading = false; MessageBox.Show("复制完成!"); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.textBox1.Text) == true) { new SRFMessageBox("用户名不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (this.textBox2.Text.Length == 0) { new SRFMessageBox("密码不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } id = SRLibFun.StringConvertToInt32(Param.DPageParameter); if (DataBase.Instance.tSR_User.Get_Entity(" Loginname=[$Loginname$] and Id !=[$Id$] ", new DataParameter("Loginname", this.textBox1.Text), new DataParameter("Id", id)) != null) { new SRFMessageBox("用户名已经被使用,请输入其它用户名!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (id > 0) { SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(id); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) { userEnt.Groupid = 1; } else if (this.radioButton2.Checked == true) { userEnt.Groupid = 2; } else if (this.radioButton3.Checked == true) { userEnt.Groupid = 3; } else if (this.radioButton4.Checked == true) { userEnt.Groupid = 4; } DataBase.Instance.tSR_User.Update(userEnt); } else { //object objval = DataBase.Instance.tSR_User.Math(FunType.Count, SR_UserEntity.FiledType.Id,null,null); //if (objval != DBNull.Value && SRLibFun.StringConvertToInt32(objval.ToString()) >=30) //{ // new SRFMessageBox("用户名数量已达到上限!", "提示", MessageBoxButtons.OK).ShowDialog(); // return; //} SR_UserEntity userEnt = new SR_UserEntity(); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) { userEnt.Groupid = 1; } else if (this.radioButton2.Checked == true) { userEnt.Groupid = 2; } else if (this.radioButton3.Checked == true) { userEnt.Groupid = 3; } else if (this.radioButton4.Checked == true) { userEnt.Groupid = 4; } id = DataBase.Instance.tSR_User.Add(userEnt); } DataBase.Instance.tSR_Systemrecord.Add(new SR_SystemrecordEntity() { Adddate = DateTime.Now, Ltype = "日志", Title = Param.Loginname, Description = this.textBox1.Text + "用户", Remark = "设置" }); new SRFMessageBox("保存成功!", "提示", MessageBoxButtons.OK).ShowDialog(); this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.textBox1.Text) == true) { new SRFMessageBox("用户名不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (this.textBox2.Text.Length == 0) { new SRFMessageBox("密码不能为空!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } id = SRLibFun.StringConvertToInt32(Param.DPageParameter); if (DataBase.Instance.tSR_User.Get_Entity(" Loginname=[$Loginname$] and Id !=[$Id$] ", new DataParameter("Loginname", this.textBox1.Text), new DataParameter("Id", id)) != null) { new SRFMessageBox("用户名已经被使用,请输入其它用户名!", "提示", MessageBoxButtons.OK).ShowDialog(); return; } if (id > 0) { SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(id); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) userEnt.Groupid = 1; else if (this.radioButton2.Checked == true) userEnt.Groupid = 2; else if (this.radioButton3.Checked == true) userEnt.Groupid = 3; else if (this.radioButton4.Checked == true) userEnt.Groupid = 4; DataBase.Instance.tSR_User.Update(userEnt); } else { //object objval = DataBase.Instance.tSR_User.Math(FunType.Count, SR_UserEntity.FiledType.Id,null,null); //if (objval != DBNull.Value && SRLibFun.StringConvertToInt32(objval.ToString()) >=30) //{ // new SRFMessageBox("用户名数量已达到上限!", "提示", MessageBoxButtons.OK).ShowDialog(); // return; //} SR_UserEntity userEnt = new SR_UserEntity(); userEnt.Loginname = this.textBox1.Text; userEnt.Pwd = this.textBox2.Text; if (this.radioButton1.Checked == true) userEnt.Groupid = 1; else if (this.radioButton2.Checked == true) userEnt.Groupid = 2; else if (this.radioButton3.Checked == true) userEnt.Groupid = 3; else if (this.radioButton4.Checked == true) userEnt.Groupid = 4; id = DataBase.Instance.tSR_User.Add(userEnt); } DataBase.Instance.tSR_Systemrecord.Add(new SR_SystemrecordEntity() { Adddate = DateTime.Now, Ltype = "日志", Title = Param.Loginname, Description = this.textBox1.Text + "用户", Remark = "设置" }); new SRFMessageBox("保存成功!", "提示", MessageBoxButtons.OK).ShowDialog(); this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); }