public static List <mg_MailModel> QueryListForPaging(string page, string pagesize, out string total) { total = "0"; List <mg_MailModel> list = null; string sql1 = @"select count(ID) total from [mg_MailConfig];"; string sql2 = @" SELECT top " + pagesize + @" ID mid ,ReceiptType ,case ReceiptType --when 1 then 'LineUp' --when 2 then 'Delgit' -- when 3 then '回冲' end as ReceiptTypeName when 1 then 'LineUpTxt加载失败' when 2 then 'LineUp订单的ProductNo在MES系统中不匹配或为空' when 3 then 'DelJetTxt加载失败' when 4 then 'DelJet订单的在LineUp订单中不匹配或对应的ProductNo不匹配' when 5 then 'DelJet订单自动拆单失败' when 6 then 'SAP手动插单Txt加载失败' when 7 then 'SAP手动插单订单自动拆单失败' when 8 then 'SAP手动插单订单的ProductNo在MES系统中不匹配或为空' when 9 then 'DelJet订单的SEQNR不连续' when 10 then 'DelJet缓存文件夹写入失败' else '' end as ReceiptTypeName ,MailRecipient ,RecipientType ,case RecipientType when 1 then '收件人' when 2 then '抄送人' end as RecipientTypeName FROM [mg_MailConfig] t1 where t1.ID not in ( select top ((" + page + @"-1)*" + pagesize + @") ID from [mg_MailConfig] order by ID desc) order by ID desc "; DataSet ds = SqlHelper.GetDataSetTableMapping(SqlHelper.SqlConnString, System.Data.CommandType.Text, sql1 + sql2, new string[] { "count", "data" }, null); if (DataHelper.HasData(ds)) { DataTable dt1 = ds.Tables["count"]; total = DataHelper.GetCellDataToStr(dt1.Rows[0], "total"); DataTable dt2 = ds.Tables["data"]; list = new List <mg_MailModel>(); foreach (DataRow row in dt2.Rows) { mg_MailModel model = new mg_MailModel(); model.mail_id = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "mid")); model.ReceiptType = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "ReceiptType")); model.ReceiptTypeName = DataHelper.GetCellDataToStr(row, "ReceiptTypeName"); model.MailRecipient = DataHelper.GetCellDataToStr(row, "MailRecipient"); model.RecipientType = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "RecipientType")); model.RecipientTypeName = DataHelper.GetCellDataToStr(row, "RecipientTypeName"); list.Add(model); } } return(list); }
public static bool AddMail(mg_MailModel model) { StringBuilder strSql = new StringBuilder(); List <SqlParameter> list = new List <SqlParameter>(); if (!string.IsNullOrEmpty(model.MailName)) { string[] idArr = model.MailName.Split(','); foreach (string MailName in idArr) { strSql.Append("INSERT INTO [mg_MailConfig]("); strSql.Append("ReceiptType,MailRecipient,RecipientType)"); strSql.Append(" values ("); strSql.Append("convert(int, (" + model.ReceiptType + ")),'" + MailName + "',convert(int,(" + model.RecipientType + ")));"); } } return(SqlHelper.ExecuteSqlTran(SqlHelper.SqlConnString, strSql.ToString(), null)); }
void saveMail() { string mail_id = Request.Params["mail_id"]; string ReceiptType = Request.Params["ReceiptType"]; //string sorting = Request.Params["sorting"]; string RecipientType = Request.Params["RecipientType"]; string MailName = Request.Params["Mail"]; mg_MailModel model = new mg_MailModel(); model.mail_id = NumericParse.StringToInt(mail_id); model.ReceiptType = NumericParse.StringToInt(ReceiptType); //model.sorting = NumericParse.StringToInt(sorting); model.RecipientType = NumericParse.StringToInt(RecipientType); model.MailName = MailName; string json = mg_MailBLL.SaveMail(model); Response.Write(json); Response.End(); }
private static string AddMail(mg_MailModel model) { bool flag = mg_MailDAL.AddMail(model); return(flag ? "true" : "false"); }
public static string SaveMail(mg_MailModel model) { return(model.mail_id == 0 ? AddMail(model) : UpdateMail(model)); }