public ActionResult Save(FormCollection f, P_CommodityType info) { int count = 0; if (info.Id > 0) { count = SugarFactory.GetInstance().Updateable <P_CommodityType>(info).ExecuteCommand(); } else { count = SugarFactory.GetInstance().Insertable <P_CommodityType>(info).ExecuteCommand(); } if (info.Id == 0) { if (count > 0) { return(Json(TipHelper.JsonData("新增类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } else { return(Json(TipHelper.JsonData("新增类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } } else { if (count > 0) { return(Json(TipHelper.JsonData("更新类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } else { return(Json(TipHelper.JsonData("更新类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } } }
public ActionResult DeleteMerchantInfo(string code) { int rcount = SugarFactory.GetInstance().Deleteable <P_MerchantInfo>().Where(it => it.Merchant_Code == Guid.Parse(code)).ExecuteCommand(); if (rcount > 0) { return(Json(TipHelper.JsonData("删除成功!", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));; } else { return(Json(TipHelper.JsonData("删除失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } }
public ActionResult Save(FormCollection fc, P_User cm) { int rcount = 0; if (!String.IsNullOrEmpty(cm.User_Pwd)) { cm.User_Pwd = Encryption.GetMd5(cm.User_Pwd); } else { P_User pu = SugarFactory.GetInstance().Queryable <P_User>().InSingle(cm.User_Code); cm.User_Pwd = pu.User_Pwd; } if (Convert.ToInt32(fc["Id"]) > 0) { rcount = SugarFactory.GetInstance().Updateable <P_User>(cm).ExecuteCommand(); } else { rcount = SugarFactory.GetInstance().Insertable <P_User>(cm).ExecuteCommand(); } string formOperateType = fc["formOperateType"].ToString().ToLower(); if (formOperateType == "saveandnewnext") { if (rcount > 0) { return(Json(TipHelper.JsonData("新增用户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage))); } else { return(Json(TipHelper.JsonData("新增用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } else { if (rcount > 0) { return(Json(TipHelper.JsonData("保存用户信息成功!", "/UserInfo/UserList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage))); } else { //表单提交失败固定写法 return(Json(TipHelper.JsonData("保存用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } }
public ActionResult SaveRoles(FormCollection f, P_SystemRoles info) { int count = 0; if (info.Role_Id > 0) { count = SugarFactory.GetInstance().Updateable <P_SystemRoles>(info).ExecuteCommand(); } else { count = SugarFactory.GetInstance().Insertable <P_SystemRoles>(info).ExecuteCommand(); } SugarFactory.GetInstance().Deleteable <P_RolesToMenu>().Where(it => it.RTM_Roles_Code == info.Role_Code).ExecuteCommand(); if (!String.IsNullOrEmpty(info.MenuCodes)) { string[] strs = info.MenuCodes.TrimEnd(',').Split(','); foreach (string item in strs) { P_RolesToMenu rtm = new P_RolesToMenu(); rtm.RTM_Menu_Code = Guid.Parse(item); rtm.RTM_Roles_Code = info.Role_Code; SugarFactory.GetInstance().Insertable <P_RolesToMenu>(rtm).ExecuteCommand(); } } if (info.Role_Id == 0) { if (count > 0) { return(Json(TipHelper.JsonData("新增角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } else { return(Json(TipHelper.JsonData("新增角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } } else { if (count > 0) { return(Json(TipHelper.JsonData("更新角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } else { return(Json(TipHelper.JsonData("更新角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage))); } } }
public ActionResult Save(FormCollection fc, AdminPanel.CodeModels.P_MerchantInfo cm) { int rcount = 0; if (Convert.ToInt32(fc["Id"]) > 0) { rcount = SugarFactory.GetInstance().Updateable <P_MerchantInfo>(cm).ExecuteCommand(); } else { rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand(); } string formOperateType = fc["formOperateType"].ToString().ToLower(); if (formOperateType == "saveandnewnext") { if (rcount > 0) { return(Json(TipHelper.JsonData("新增商户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage))); } else { return(Json(TipHelper.JsonData("新增商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } else { if (rcount > 0) { return(Json(TipHelper.JsonData("保存商户信息成功!", "/MerchantInfo/MerchantInfoList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage))); } else { //表单提交失败固定写法 return(Json(TipHelper.JsonData("保存商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } }
public ActionResult DeleteRoles(string code) { SugarFactory.GetInstance().Deleteable <P_SystemRoles>().Where(it => it.Role_Code == Guid.Parse(code)).ExecuteCommand(); return(Json(TipHelper.JsonData("删除成功!", "AnyTimeList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage))); }