public string Added(FormCollection form) { var stateInfo = GeneralHandler.StateSuccess; if (AddedByCheck(form, out stateInfo)) { DawnAuthExtentMDL dataInfo = new DawnAuthExtentMDL(); dataInfo.ExteTime = DateTime.Now; dataInfo.ExteStatus = 1; dataInfo.ExteCode = form["txtCode"].Trim(); dataInfo.ExteCodeName = form["txtCodeName"].Trim(); dataInfo.ExteMark = form["txtMark"].Trim(); dataInfo.ExteMarkName = form["txtMarkName"].Trim(); dataInfo.ExteMemo = form["txtMemo"].Trim(); bool added = DawnAuthExtentBLL.Exists(string.Format("exte_code='{0}' and exte_mark='{1}'", dataInfo.ExteCode, dataInfo.ExteMark)); if (added) { stateInfo = GeneralHandler.StateAdded; } else { DawnAuthExtentBLL.Insert(dataInfo); } } return(stateInfo); }
public string Synced(FormCollection form) { var stateInfo = GeneralHandler.StateSuccess; if (GetSyncDataByCheck(form, out stateInfo)) { string txtSetCode = form["txtSetCode"] as string; string txtSetName = form["txtSetName"] as string; int sltSyncItem = TypeHelper.TypeToInt32(form["sltSyncItem"], 2); string txtFieldTable = form["txtFieldTable"] as string; string txtFieldMark = form["txtFieldMark"] as string; string txtFieldName = form["txtFieldName"] as string; string txtFieldMemo = form["txtFieldMemo"] as string; string txtFieldWhere = form["txtFieldWhere"] as string; string txtConnSource = form["txtConnSource"] as string; string txtConnData = form["txtConnData"] as string; string txtConnUser = form["txtConnUser"] as string; string txtConnPwd = form["txtConnPwd"] as string; System.Data.DataTable dt = Session["ExtentSyncData"] as System.Data.DataTable;//直接获取会话数据 try { if (dt.Rows.Count > 0) { if (sltSyncItem == 2) { DawnAuthExtentBLL.DeleteWhere(string.Format("exte_status=2 and exte_code='{0}'", txtSetCode)); } System.Text.StringBuilder sb = new System.Text.StringBuilder(); //DawnAuthExtentMDL dataInfo; DawnAuthExtentMDL dataInfo = new DawnAuthExtentMDL(); foreach (System.Data.DataRow dr in dt.Rows) { //dataInfo = new DawnAuthExtentMDL(); dataInfo.ExteTime = DateTime.Now; dataInfo.ExteStatus = 2; dataInfo.ExteCode = txtSetCode; dataInfo.ExteCodeName = txtSetName; dataInfo.ExteMark = dr[txtFieldMark].ToString(); dataInfo.ExteMarkName = dr[txtFieldName].ToString(); dataInfo.ExteMemo = txtFieldMemo == "null" ? "无" : dr[txtFieldMemo].ToString(); DawnAuthExtentBLL.Insert(dataInfo); } dataInfo = null; } else { stateInfo = "请先执行【获取数据】操作后,再执行【开始同步】操作。"; } Session["ExtentSyncData"] = null; } catch (Exception ex) { Session["ExtentSyncData"] = null; stateInfo = ex.Message; GeneralHandler.InsertByError(ex); } } return(stateInfo); }