/// <summary> /// 获得数据列表 /// </summary> public List <LPWeb.Model.Company_General> DataTableToList(DataTable dt) { List <LPWeb.Model.Company_General> modelList = new List <LPWeb.Model.Company_General>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LPWeb.Model.Company_General model; for (int n = 0; n < rowsCount; n++) { model = new LPWeb.Model.Company_General(); model.Name = dt.Rows[n]["Name"].ToString(); model.AD_OU_Filter = dt.Rows[n]["AD_OU_Filter"].ToString(); model.Desc = dt.Rows[n]["Desc"].ToString(); model.Address = dt.Rows[n]["Address"].ToString(); model.City = dt.Rows[n]["City"].ToString(); model.State = dt.Rows[n]["State"].ToString(); model.Zip = dt.Rows[n]["Zip"].ToString(); if (dt.Rows[n]["ImportUserInterval"].ToString() != "") { model.ImportUserInterval = int.Parse(dt.Rows[n]["ImportUserInterval"].ToString()); } model.Prefix = dt.Rows[n]["Prefix"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 同步按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSync_Click(object sender, EventArgs e) { try { // 请大家不要使用 System.Transactions.TransactionScope, 它导致Service崩溃. //using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope()) //{ LPWeb.BLL.Company_General bllCG = new LPWeb.BLL.Company_General(); LPWeb.Model.Company_General modGeneral = new LPWeb.Model.Company_General(); modGeneral = bllCG.GetModel(); modGeneral.StartMarketingSync = true; bllCG.Update(modGeneral); ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { string err = ""; if (!client.SyncMarketingData(ref err)) { PageCommon.AlertMsg(this, err); return; } //ts.Complete(); } //} PageCommon.WriteJsEnd(this, "Sync Marketing Info successfully.", PageCommon.Js_RefreshSelf); } catch (Exception ex) { PageCommon.AlertMsg(this, ex.Message); return; } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.Company_General model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(LPWeb.Model.Company_General model) { dal.Add(model); }