public string BaseSave() { if (df_begin.SelectedValue == null || cbbBc.SelectedIndex == -1 || cbbPerson.SelectedIndex == -1) { //Ext.Msg.Alert("提示", "请填写完整信息!").Show(); return("请填写完整信息!"); } if (df_begin.SelectedDate < System.DateTime.Today) { //Ext.Msg.Alert("提示", "只能制定本日及以后的计划!").Show(); return("只能制定本日及以后的计划!"); } if (dc.YChargetable.Where(p => p.Cdate == df_begin.SelectedDate && p.Cbanci == cbbBc.SelectedItem.Value && p.Cperson == cbbPerson.SelectedItem.Value).Count() > 0) { //Ext.Msg.Alert("提示", "已添加的计划!").Show(); return("已添加的计划!"); } if (cboPlaceTemplate.SelectedIndex <= -1) { YChargetable ct = new YChargetable { Recordtime = System.DateTime.Now, Rperson = SessionBox.GetUserSession().PersonNumber, Cdate = df_begin.SelectedDate, Cbanci = cbbBc.SelectedItem.Value, Cperson = cbbPerson.SelectedItem.Value, Maindept = SessionBox.GetUserSession().DeptNumber, Status = 1 }; dc.YChargetable.InsertOnSubmit(ct); dc.SubmitChanges(); //RecordAction(ct.Id, "新增"); //Ext.Msg.Alert("提示", "新增成功!").Show(); Ext.DoScript("#{Store1}.reload();"); return("新增成功!"); } else if (cboPlaceTemplate.SelectedItem.Value != "-1") { HBBLL hb = new HBBLL(); if (hb.HaveMoveTemplate(int.Parse(cboPlaceTemplate.SelectedItem.Value)) > 0) { DateTime dt = System.DateTime.Now; YChargetable ct = new YChargetable { Recordtime = dt, Rperson = SessionBox.GetUserSession().PersonNumber, Cdate = df_begin.SelectedDate, Cbanci = cbbBc.SelectedItem.Value, Cperson = cbbPerson.SelectedItem.Value, Maindept = SessionBox.GetUserSession().DeptNumber, Status = 1 }; dc.YChargetable.InsertOnSubmit(ct); dc.SubmitChanges(); foreach (YPPTDetail pt in hb.GetYPPTDetail(int.Parse(cboPlaceTemplate.SelectedItem.Value), "", SessionBox.GetUserSession().DeptNumber, "")) { YPlanplace pp = new YPlanplace { Ctid = ct.Id, Recordtime = dt, Placeid = decimal.Parse(pt.PlaceId.ToString()), Moveorder = decimal.Parse(pt.MoveOrder.ToString()) }; hb.AddYPlanplace(pp.Recordtime, pp.Placeid, pp.Moveorder.Value, pp.Ctid); //dc.YPlanplace.InsertOnSubmit(pp); //dc.SubmitChanges(); } //RecordAction(ct.Id, "新增"); //RecordAction(ct.Id, "添加地点"); //Ext.Msg.Alert("提示", "新增成功!").Show(); //storeload(); Ext.DoScript("#{Store1}.reload();"); return("新增成功!"); } else { //Ext.Msg.Alert("提示", "请确保模板里有走动线路!").Show(); return("请确保模板里有走动线路!"); } } else { //Ext.Msg.Alert("提示", "未知错误!").Show(); return("未知错误!"); } }