/// <summary> /// 修改弹窗赋值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Click(object sender, EventArgs e) { try { //获取button 控件 LinkButton lb = (LinkButton)sender; //获取传过来的commwntid int id = Convert.ToInt32(lb.CommandArgument); //Maticsoft.Model.Operator oauser = (Maticsoft.Model.Operator)Session["user"]; Model.Operator ope = op.GetModel(id); Label2.Text = ope.id.ToString(); DropDownList2.Text = ope.StaffmemberID.ToString(); TextBox4.Text = ope.name; TextBox5.Text = ope.Beizhu; TextBox10.Text = null; TextBox8.Text = null; TextBox9.Text = null; ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv2();</script>"); } catch (Exception ee) { //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('修改弹窗异常 " + ee.Message + "');</script>"); } }
/// <summary> /// 修改设备操作人信息 /// </summary> public static bool ChangeOperator(Model.Operator op) { bool f = DAL.DA_Operator.ChangeOperator(op); listOperator = GetOperatorList(); return(f); }
/// <summary> /// 添加设备操作人 /// </summary> public static bool AddOperator(Model.Operator op) { string sql = "insert into ROSO_Operator(OperatorID,OperatorName) values(@OperatorID,@OperatorName)"; SqlParameter[] p = { new SqlParameter("@OperatorID", op.OperatorID), new SqlParameter("@OperatorName", op.OperatorName) }; int i = SQLHelper.ExecuteNonQuery(sql, CommandType.Text, p); return(i > 0); }
/// <summary> /// 修改设备操作人信息 /// </summary> public static bool ChangeOperator(Model.Operator op) { string sql = "update ROSO_Operator set OperatorName=@OperatorName where OperatorID=@OperatorID"; SqlParameter[] p = { new SqlParameter("@OperatorID", op.OperatorID), new SqlParameter("@OperatorName", op.OperatorName) }; int i = SQLHelper.ExecuteNonQuery(sql, CommandType.Text, p); return(i > 0); }
/// <summary> /// 删除(该操作员有生成单据停用否则删除) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton2_Click(object sender, EventArgs e) { try { //获取button 控件 LinkButton lb = (LinkButton)sender; //获取传过来的commwntid int id = Convert.ToInt32(lb.CommandArgument); DataSet dwq = ot.GetList(" StaffmemberID like '" + id + "' or UserTabID like '" + id + "'"); if (dwq.Tables[0].Rows.Count > 0) { Model.Operator czy = op.GetModel(id); czy.BranchID = 0; bool a = op.Update(czy); if (a == true) { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('停用成功!');</script>"); bind(sql); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('停用失败!');</script>"); bind(sql); } } else { bool a = op.Delete(id); if (a == true) { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除成功!');</script>"); bind(sql); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除失败!');</script>"); bind(sql); } } } catch (Exception ee) { //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除异常 " + ee.Message + "');</script>"); } }
/// <summary> /// 获取所有操作人列表 /// </summary> public static List <Model.Operator> GetOperatorList() { string sql = "select * from ROSO_Operator order by OperatorID"; List <Model.Operator> list = new List <Model.Operator>(); using (SqlDataReader dr = SQLHelper.ExecuteReader(sql, CommandType.Text, null)) { while (dr.Read()) { Model.Operator op = new Model.Operator(); op.ID = Convert.ToInt32(dr["ID"]); op.OperatorID = Convert.ToInt32(dr["OperatorID"]); op.OperatorName = Convert.ToString(dr["OperatorName"]); list.Add(op); } } return(list); }
/// <summary> /// 根据ID获取操作人 /// </summary> public static Model.Operator GetOperator(Int32 operatorID) { string sql = "select * from ROSO_Operator where OperatorID=@OperatorID"; SqlParameter[] p = { new SqlParameter("@OperatorID", operatorID) }; Model.Operator op = new Model.Operator(); using (SqlDataReader dr = SQLHelper.ExecuteReader(sql, CommandType.Text, p)) { if (dr.Read()) { op.ID = Convert.ToInt32(dr["ID"]); op.OperatorID = Convert.ToInt32(dr["OperatorID"]); op.OperatorName = Convert.ToString(dr["OperatorName"]); } } return(op); }
public string zyselectlist(string userid, string condition) { try { if (condition != "") { sql = " and (MemberName like '%" + condition + "%' or MemberPhone like '%" + condition + "%' or MemberPhone1 like '%" + condition + "%') "; } else { sql = ""; } Model.Operator user = op.GetModel(Convert.ToInt32(userid)); if (user.name == "admin") { DataTable biao = DbHelperSQL.Query("select ordertab.id,OrderNumber,MemberName,MemberPhone,MemberPhone1,validity,Operator.StaffmemberID,Staffname,AllMoney,AllMoney-Deposit wfk,case when Zhuangtai1=0 then '草稿' when Zhuangtai1=1 then '下单' end Zhuangtai1,case when progress=0 then '生成草稿' when progress=1 then '确认下单' when progress=2 then '排产' when progress=3 then '生产中' when progress=4 then '入库' when progress=5 then '可送货' else '完成' end progress from ordertab left join Operator on UserTabID=Operator.id left join Staffmember on Operator.StaffmemberID=Staffmember.id where progress<6 " + sql + " order by validity desc,allmoney desc ").Tables[0]; if (biao.Rows.Count > 0) { string qq = JsonHelper.DataSetToJson(biao); qq = qq.Substring(1, qq.Length - 2); return(@"{""data"":{""ds"":""1""," + qq + "}}"); } else { return(@"{""data"":{""ds"":""0""}}"); } } else { DataSet dw = pt.GetList(" Operatorid like '" + user.id + "'"); if (dw.Tables[0].Rows[0]["look"].Equals(0)) { DataTable biao = DbHelperSQL.Query("select ordertab.id,OrderNumber,MemberName,MemberPhone,MemberPhone1,validity,Operator.StaffmemberID,Staffname,AllMoney,AllMoney-Deposit wfk,case when Zhuangtai1=0 then '草稿' when Zhuangtai1=1 then '下单' end Zhuangtai1,case when progress=0 then '生成草稿' when progress=1 then '确认下单' when progress=2 then '排产' when progress=3 then '生产中' when progress=4 then '入库' when progress=5 then '可送货' else '完成' end progress from ordertab left join Operator on UserTabID=Operator.id left join Staffmember on Operator.StaffmemberID=Staffmember.id where progress<6 and UserTabID like '" + user.id + "' " + sql + " order by validity desc,allmoney desc ").Tables[0]; if (biao.Rows.Count > 0) { string qq = JsonHelper.DataSetToJson(biao); qq = qq.Substring(1, qq.Length - 2); return(@"{""data"":{""ds"":""1""," + qq + "}}"); } else { return(@"{""data"":{""ds"":""0""}}"); } } else { DataTable biao = DbHelperSQL.Query("select ordertab.id,OrderNumber,MemberName,MemberPhone,MemberPhone1,validity,Operator.StaffmemberID,Staffname,AllMoney,AllMoney-Deposit wfk,case when Zhuangtai1=0 then '草稿' when Zhuangtai1=1 then '下单' end Zhuangtai1,case when progress=0 then '生成草稿' when progress=1 then '确认下单' when progress=2 then '排产' when progress=3 then '生产中' when progress=4 then '入库' when progress=5 then '可送货' else '完成' end progress from ordertab left join Operator on UserTabID=Operator.id left join Staffmember on Operator.StaffmemberID=Staffmember.id where progress<6 " + sql + " order by validity desc,allmoney desc ").Tables[0]; if (biao.Rows.Count > 0) { string qq = JsonHelper.DataSetToJson(biao); qq = qq.Substring(1, qq.Length - 2); return(@"{""data"":{""ds"":""1""," + qq + "}}"); } else { return(@"{""data"":{""ds"":""0""}}"); } } } } catch (Exception ee) { return(@"{""data"":{""ds"":""-1"",""sm"":""数据处理有误:" + ee.Message + "\"}}"); } }
/// <summary> /// 根据ID获取操作人姓名,从静态列表中获取,效率高 /// </summary> /// <param name="operatorID"></param> /// <returns></returns> public static string GetOperatorName(Int32 operatorID) { Model.Operator op = listOperator.Find(p => p.OperatorID.Equals(operatorID)); return(op.OperatorName); }
/// <summary> /// 添加部门(确定按钮) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, EventArgs e) { try { if (DropDownList1.Text != "0") { if (TextBox1.Text.Trim() != "") { if (TextBox6.Text.Trim() != "") { if (TextBox6.Text.Trim() == TextBox7.Text.Trim()) { DataSet dss = op.GetList(" name like '" + TextBox1.Text + "' and pwd like '" + FormsAuthentication.HashPasswordForStoringInConfigFile(this.TextBox6.Text.Trim(), "MD5") + "'"); if (dss.Tables[0].Rows.Count > 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('账号密码以存在!');</script>"); TextBox1.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } else { Maticsoft.Model.Operator czy = new Model.Operator(); czy.StaffmemberID = Convert.ToInt32(DropDownList1.Text); czy.name = TextBox1.Text; czy.pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(this.TextBox6.Text.Trim(), "MD5"); czy.Beizhu = TextBox2.Text; czy.BranchID = 1; int a = op.Add(czy); if (a > 0) { DataSet er = op.GetList(" name like '" + TextBox1.Text + "' and pwd like '" + FormsAuthentication.HashPasswordForStoringInConfigFile(this.TextBox6.Text.Trim(), "MD5") + "' and StaffmemberID like '" + DropDownList1.Text + "' and BranchID like '1'"); Model.Permissionstab per = new Model.Permissionstab(); per.Operatorid = Convert.ToInt32(er.Tables[0].Rows[0]["id"]); per.Look = 0; per.Audit = 0; int aa = pe.Add(per); if (aa > 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加成功!');</script>"); bind(sql); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('权限添加失败!');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加失败!');</script>"); bind(sql); } } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('2次输入的密码不一致请重新输入!');</script>"); TextBox6.Text = ""; TextBox7.Text = ""; ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('密码不能为空!');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('账号不能为空!');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('没选职员!');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } catch (Exception ee) { //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('确定异常 " + ee.Message + "');</script>"); } }