protected void Application_Error(object sender, EventArgs e) { Exception err = Server.GetLastError(); if (err == null) { err = new Exception("Unknown Error"); } StringBuilder errMsg = new StringBuilder(); errMsg.Append(string.Format("<p style='font-size:8pt;'>{0}</p>",err.Message)); errMsg.Append(string.Format("<p style='font-size:8pt;'>{0}</p>", err.StackTrace)); errMsg.Append(string.Format("<p style='font-size:8pt;'>{0}</p>", err.InnerException.ToString())); Application["err"] = errMsg; /*//������Ա���ʼ�*/ Mail mail = new Mail(); StringBuilder errBody = new StringBuilder(); Authentication.LOGININFO user = (Authentication.LOGININFO)Session["USERINFO"]; errBody.Append(DateTime.Now.ToString()); errBody.Append("<br>"); errBody.Append(user.UserID); errBody.Append("@"); errBody.Append(user.ServerName); errBody.Append("<br>"); errBody.Append(err.InnerException.ToString()); errBody.Append("<br>"); errBody.Append(err.StackTrace); mail.Send("JP ERROR", errBody.ToString(), "*****@*****.**", "*****@*****.**", "", true, false, null, null); }
private void SendLackMailInTime() { jzpl.Lib.Mail myMail = new jzpl.Lib.Mail(); string SQLReleaseUsers = "select t1.release_user,wm_concat(t1.demand_id) demand_id from (select * from JP_DEMAND_CHECK_QTY_V t where t.tod_qty>t.yes_qty) t1 group by t1.release_user"; DataTable ReleaseUsers = DBHelper.GetDataset(SQLReleaseUsers).Tables[0]; string Mail = string.Empty; for (int i = 0; i < ReleaseUsers.Rows.Count; i++) { string ReleaseUser = ReleaseUsers.Rows[i][0].ToString(); string DemandID = ReleaseUsers.Rows[i][1].ToString(); string MailBody = "物资需求单号为: " + DemandID + "的物资有到货"; Mail += ReleaseUser + '\t' + MailBody + '\n'; WriteTextFile(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "send lack mail--to:" + ReleaseUser + "@cimc-raffles.com" + "--:" + MailBody, ServerLogPath); myMail.Send("到货提醒", MailBody, "*****@*****.**", ReleaseUser + "@cimc-raffles.com", "*****@*****.**", true, false, null, null); } }
//提交下达命令 protected void GVData_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = (GridViewRow)(((ImageButton)e.CommandSource).Parent.Parent); //获取参数 string _releasedate_str = ((TextBox)(gvr.Cells[1].FindControl("TextReceiveDate"))).Text; float _releaseQty = Convert.ToSingle(((TextBox)(gvr.Cells[1].FindControl("TxtReleaseQty"))).Text); float _lack_Qty = Convert.ToSingle(gvr.Cells[4].Text); string _reciever = gvr.Cells[9].Text; if (_releaseQty == 0 || _releaseQty > _lack_Qty) { Misc.Message(this.GetType(), ClientScript, "下达数量非法。"); return; } //验证时间 DateTime releasedate = new DateTime(1900, 1, 1); if (!string.IsNullOrEmpty(_releasedate_str)) { try { releasedate = Convert.ToDateTime(_releasedate_str); } catch (Exception em) { Misc.Message(this.GetType(), ClientScript, "请选择配送时间."); return; } } else { Misc.Message(this.GetType(), ClientScript, "请选择配送时间。"); return; } string[] temp; using (OleDbConnection conn = new OleDbConnection(Lib.DBHelper.OleConnectionString)) { try { if (conn.State != ConnectionState.Open) { conn.Open(); } OleDbCommand cmd = new OleDbCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; temp = e.CommandArgument.ToString().Split('^'); if (temp.Length != 2) { Misc.Message(this.GetType(), ClientScript, "操作失败,错误参数。"); return; } cmd.CommandText = "jp_demand_api.release_lack_"; //进行缺料下达 cmd.Parameters.Add("v_objid", OleDbType.VarChar).Value = temp[0]; cmd.Parameters.Add("v_rowversion", OleDbType.VarChar).Value = temp[1]; cmd.Parameters.Add("v_release_qty", OleDbType.Decimal).Value = _releaseQty; cmd.Parameters.Add("v_release_date", OleDbType.Date).Value = releasedate; cmd.Parameters.Add("v_release_user", OleDbType.VarChar).Value = ((Authentication.LOGININFO)Session["USERINFO"]).UserID; cmd.Parameters.Add("v_requistion_id_", OleDbType.VarChar, 200).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); String v_requistion_id_ = cmd.Parameters["v_requistion_id_"].Value.ToString(); if (v_requistion_id_.Length > 0) { Lib.Mail myMail = new Lib.Mail(); myMail.Send("您有一笔缺品物料配送需确认", _reciever + "你好," + ((Authentication.LOGININFO)Session["USERINFO"]).UserID + "刚才为你生成一笔缺品配送单,配送日期为:" + releasedate.ToString().Split(' ')[0] + "。请尽快登录【集中配料系统】进行确认", "*****@*****.**", _reciever + "@cimc-raffles.com", ((Authentication.LOGININFO)Session["USERINFO"]).UserID + "@cimc-raffles.com", true, false, null, null); } //Misc.Message(Response, "下达!"); GVDataBind(); } catch (Exception ex) { if (Misc.CheckIsDBCustomException(ex)) { Misc.Message(this.GetType(), ClientScript, Misc.GetDBCustomException(ex)); } else { throw ex; } } } }
//�ύ�´����� protected void GVData_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = (GridViewRow)(((ImageButton)e.CommandSource).Parent.Parent); //��ȡ���� string _releasedate_str = ((TextBox)(gvr.Cells[1].FindControl("TextReceiveDate"))).Text; float _releaseQty = Convert.ToSingle(((TextBox)(gvr.Cells[1].FindControl("TxtReleaseQty"))).Text); float _lack_Qty = Convert.ToSingle(gvr.Cells[4].Text); string _reciever = gvr.Cells[9].Text; if (_releaseQty == 0 || _releaseQty > _lack_Qty) { Misc.Message(this.GetType(), ClientScript, "�´������Ƿ���"); return; } //��֤ʱ�� DateTime releasedate = new DateTime(1900, 1, 1); if (!string.IsNullOrEmpty(_releasedate_str)) { try { releasedate = Convert.ToDateTime(_releasedate_str); } catch (Exception em) { Misc.Message(this.GetType(), ClientScript, "��ѡ������ʱ��."); return; } } else { Misc.Message(this.GetType(), ClientScript, "��ѡ������ʱ�䡣"); return; } string[] temp; using (OleDbConnection conn = new OleDbConnection(Lib.DBHelper.OleConnectionString)) { try { if (conn.State != ConnectionState.Open) conn.Open(); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; temp = e.CommandArgument.ToString().Split('^'); if (temp.Length != 2) { Misc.Message(this.GetType(), ClientScript, "����ʧ�ܣ����������"); return; } cmd.CommandText = "jp_demand_api.release_lack_";//����ȱ���´� cmd.Parameters.Add("v_objid", OleDbType.VarChar).Value = temp[0]; cmd.Parameters.Add("v_rowversion", OleDbType.VarChar).Value = temp[1]; cmd.Parameters.Add("v_release_qty", OleDbType.Decimal).Value = _releaseQty; cmd.Parameters.Add("v_release_date", OleDbType.Date).Value = releasedate; cmd.Parameters.Add("v_release_user", OleDbType.VarChar).Value = ((Authentication.LOGININFO)Session["USERINFO"]).UserID; cmd.Parameters.Add("v_requistion_id_", OleDbType.VarChar, 200).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); String v_requistion_id_ = cmd.Parameters["v_requistion_id_"].Value.ToString(); if (v_requistion_id_.Length > 0) { Lib.Mail myMail = new Lib.Mail(); myMail.Send("����һ��ȱƷ����������ȷ��", _reciever + "��ã�" + ((Authentication.LOGININFO)Session["USERINFO"]).UserID + "�ղ�Ϊ������һ��ȱƷ���͵�����������Ϊ:" + releasedate.ToString().Split(' ')[0]+"���뾡���¼����������ϵͳ������ȷ��", "*****@*****.**", _reciever + "@cimc-raffles.com", ((Authentication.LOGININFO)Session["USERINFO"]).UserID + "@cimc-raffles.com", true, false, null, null); } //Misc.Message(Response, "�´"); GVDataBind(); } catch (Exception ex) { if (Misc.CheckIsDBCustomException(ex)) { Misc.Message(this.GetType(), ClientScript, Misc.GetDBCustomException(ex)); } else { throw ex; } } } }
private void SendLackMailInTime() { jzpl.Lib.Mail myMail = new jzpl.Lib.Mail(); string SQLReleaseUsers = "select t1.release_user,wm_concat(t1.demand_id) demand_id from (select * from JP_DEMAND_CHECK_QTY_V t where t.tod_qty>t.yes_qty) t1 group by t1.release_user"; DataTable ReleaseUsers = DBHelper.GetDataset(SQLReleaseUsers).Tables[0]; string Mail = string.Empty; for (int i = 0; i < ReleaseUsers.Rows.Count; i++) { string ReleaseUser = ReleaseUsers.Rows[i][0].ToString(); string DemandID = ReleaseUsers.Rows[i][1].ToString(); string MailBody = "��������Ϊ: " + DemandID + "�������е���"; Mail += ReleaseUser + '\t' + MailBody + '\n'; WriteTextFile(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "send lack mail--to:" + ReleaseUser + "@cimc-raffles.com" + "--:" + MailBody, ServerLogPath); myMail.Send("��������", MailBody, "*****@*****.**", ReleaseUser + "@cimc-raffles.com", "*****@*****.**", true, false, null, null); } }