/// <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; } }