/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { string guid = CommonHelper.GetGuid; Hashtable ht = new Hashtable(); if (Roles_Name.Value != "") { ht["Roles_Name"] = Roles_Name.Value; } ht["Roles_Remark"] = Roles_Remark.Value; ht["ParentId"] = "0"; ht["AllowEdit"] = "1"; ht["SortCode"] = SortCode.Value; ht["Hotel_Id"] = HotelId.Value; ht["AdminHotelid"] = HotelAdmin.Value; if (!string.IsNullOrEmpty(hdRoleId.Value)) { guid = hdRoleId.Value; ht["ModifyDate"] = DateTime.Now; ht["ModifyUserId"] = RequestSession.GetSessionUser().UserId; ht["ModifyUserName"] = RequestSession.GetSessionUser().UserName; } else { ht["Roles_ID"] = guid; ht["CreateUserId"] = RequestSession.GetSessionUser().UserId; ht["CreateUserName"] = RequestSession.GetSessionUser().UserName; ht["CreateDate"] = DateTime.Now; } ht["ModifyDate"] = DateTime.Now; ht["DeleteMark"] = 1; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_Roles", "Roles_ID", hdRoleId.Value, ht); if (IsOk) { IsOk = this.add_ItemForm(checkbox_value.Value.Split(','), guid); } if (IsOk) { ShowMsgHelper.AlertReloadClose("操作成功!", "ListGrid(false)"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } }
/// <summary> /// 编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSumit_Click(object sender, EventArgs e) { if (Request.QueryString["ID"] != null) { Hashtable ht = new Hashtable(); ht["State"] = hfState.Value; ht["Processing"] = lblProcessing.Value; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("BookOrder", "ID", Request.QueryString["ID"].ToString(), ht); if (IsOk) { ShowMsgHelper.AlertReloadClose("提交成功!", "ListGrid()"); } else { ShowMsgHelper.Alert_Error("提交失败!"); } } }
/// <summary> /// 编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSumit_Click(object sender, EventArgs e) { Hashtable hss = new Hashtable(); hss["Name"] = txtKindName.Value; hss["AdminHotelid"] = RequestSession.GetSessionUser().AdminHotelid.ToString(); if (Request["ID"] != null) { //修改 int a = DataFactory.SqlDataBase().UpdateByHashtable("CouponType", "ID", Request["ID"], hss); if (a > 0) { ShowMsgHelper.AlertReloadClose("修改成功!", "ListGrid()"); CommonMethod.Base_Log("卡券管理", "CouponType", "AdminHotelid:" + hss["AdminHotelid"], "修改卡券类型信息", "修改卡券类型信息");//操作记录 } else { ShowMsgHelper.AlertReloadClose("修改失败!", "ListGrid()"); } } else { //添加 int a = DataFactory.SqlDataBase().InsertByHashtable("CouponType", hss); if (a > 0) { ShowMsgHelper.AlertReloadClose("添加成功!", "ListGrid()"); CommonMethod.Base_Log("卡券管理", "CouponType", "AdminHotelid:" + hss["AdminHotelid"], "添加卡券类型信息", "添加卡券类型信息");//操作记录 } else { ShowMsgHelper.AlertReloadClose("添加失败!", "ListGrid()"); } } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { string guid = CommonHelper.GetGuid; Hashtable ht = new Hashtable(); ht["Rule_Name"] = Rule_Name.Value; ht["Sales_Val"] = Sales_Val.Value; ht["Sales_Type"] = Sales_Type.Value; ht["Breakfast_Type"] = Breakfast_Type.Value; ht["Breakfast_Val"] = Breakfast_Val.Value; ht["Pay_Type"] = Pay_Type.Value; ht["Vip_Type"] = Vip_Type.Value; ht["Vip_Val"] = Vip_Val.Value; ht["Remarks"] = Remarks.Value; if (!string.IsNullOrEmpty(Discount.Value)) { ht["Discount"] = Discount.Value; } if (!string.IsNullOrEmpty(DiscountType.Value)) { ht["DiscountType"] = DiscountType.Value; } if (!string.IsNullOrEmpty(jyDiscount.Value)) { ht["jyDiscount"] = jyDiscount.Value; } bool IsOk = false; if (!string.IsNullOrEmpty(hdId.Value)) { ht["ModifyDate"] = DateTime.Now; ht["ModifyUserId"] = RequestSession.GetSessionUser().UserId; ht["ModifyUserName"] = RequestSession.GetSessionUser().UserName; IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Room_Rule", "ID", hdId.Value, ht); } else { ht["Room_ID"] = Room_ID.Value; ht["HotelId"] = hdHotelId.Value; ht["CreateUserId"] = RequestSession.GetSessionUser().UserId; ht["CreateUserName"] = RequestSession.GetSessionUser().UserName; ht["CreateDate"] = DateTime.Now; string[] rommIds = hdRoomIds.Value.Split(','); for (int i = 0; i < rommIds.Count(); i++) { ht["Room_ID"] = rommIds[i]; IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Room_Rule", "ID", "", ht); } } if (IsOk) { ShowMsgHelper.AlertReloadClose("操作成功!", "ListGrid()"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } }
/// <summary> /// 编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSumit_Click(object sender, EventArgs e) { if (Request.QueryString["ID"] != null) { Hashtable ht = new Hashtable(); ht["HotelId"] = Request.QueryString["HotelId"]; ht["HotelName"] = Request.QueryString["HotelName"]; ht["BusinessName"] = txtBusinessName.Value; ht["TypeId"] = ddlType.SelectedValue; ht["TypeName"] = ddlType.SelectedItem.Text; if (ddlRestaurant.SelectedValue != null && ddlRestaurant.SelectedValue != "") { ht["RestaurantId"] = ddlRestaurant.SelectedValue; ht["RestaurantName"] = ddlRestaurant.SelectedItem.Text; } ht["Telephone"] = txtTelephone.Value; ht["Extension"] = txtExtension.Value; ht["BusinessTime"] = txtBusinessTime.Value; ht["BusinessTime1"] = txtBusinessTime1.Value; ht["BusinessTime2"] = txtBusinessTime2.Value; ht["BusinessTime3"] = txtBusinessTime3.Value; ht["BusinessAddress"] = txtBusinessAddress.Value; //ht["Introduction"] = txtIntroduction.Value; ht["Introduction"] = fckContent.Value; ht["Reservation"] = hfReservation.Value; ht["OrderMeal"] = hfOrderMeal.Value; ht["isopen"] = hfisopen.Value; ht["Recontent"] = txtRecontent.Value; ht["AdminHotelid"] = RequestSession.GetSessionUser().AdminHotelid.ToString(); ht["Map"] = txtMap.Value; ht["BookUrl"] = txtBookUrl.Value; ht["ButtonName"] = txtButtonName.Value; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Bookings", "ID", Request["ID"], ht); if (IsOk) { ShowMsgHelper.AlertReloadClose("处理成功!", "ListGrid()"); string[] arr = hfBusinImage.Value.ToString().Split(','); int a = 0; //清空关联的图片重新添加 string PID = Request.QueryString["ID"].ToString(); string sqldel = string.Format(@"delete BusinPhoto where type='{0}' and Pid='{1}' and AdminHotelid='{2}'", (int)DefaultFilePath.SystemType.BusinPhoto, PID, RequestSession.GetSessionUser().AdminHotelid); DataFactory.SqlDataBase().ExecuteBySql(new StringBuilder(sqldel)); for (int i = 0; i < arr.Length - 1; i++) { Hashtable hs = new Hashtable(); hs["AdminHotelid"] = RequestSession.GetSessionUser().AdminHotelid.ToString(); hs["ImgFile"] = arr[i]; hs["Hotelid"] = hdHotelId.Value; hs["PID"] = PID.ToString(); hs["BusinId"] = PID.ToString(); hs["Type"] = (int)DefaultFilePath.SystemType.BusinPhoto; a = DataFactory.SqlDataBase().InsertByHashtable("BusinPhoto", hs); } //更新餐厅关联 if (ddlRestaurant.SelectedValue != null && ddlRestaurant.SelectedValue != "") { Hashtable hss = new Hashtable(); hss["BusinId"] = Request["ID"]; hss["BusinName"] = txtBusinessName.Value; DataFactory.SqlDataBase().UpdateByHashtable("Restaurant", "ID", ddlRestaurant.SelectedValue, hss); } } else { ShowMsgHelper.AlertReloadClose("处理失败!", "ListGrid()"); } } else { string sql = string.Format("select sort from Bookings order by Sort desc"); DataTable ds = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql)); if (ds != null && ds.Rows.Count > 0) { sort = Convert.ToInt32(ds.Rows[0]["sort"].ToString()) + 1; } else { sort = 1; } Hashtable ht = GetHashtable(); int i = DataFactory.SqlDataBase().InsertByHashtableReturnPkVal("Bookings", ht); if (i > 0) { ShowMsgHelper.AlertReloadClose("添加成功!", "ListGrid()"); string[] arr = hfBusinImage.Value.ToString().Split(','); int a = 0; //清空关联的图片重新添加 for (int j = 0; j < arr.Length - 1; j++) { Hashtable hs = new Hashtable(); hs["AdminHotelid"] = RequestSession.GetSessionUser().AdminHotelid.ToString(); hs["ImgFile"] = arr[j]; hs["Hotelid"] = hdHotelId.Value; hs["PID"] = i.ToString(); hs["BusinId"] = i.ToString(); hs["Type"] = (int)DefaultFilePath.SystemType.BusinPhoto; a = DataFactory.SqlDataBase().InsertByHashtable("BusinPhoto", hs); } //更新餐厅关联 if (ddlRestaurant.SelectedValue != null && ddlRestaurant.SelectedValue != "") { Hashtable hss = new Hashtable(); hss["BusinId"] = i; hss["BusinName"] = txtBusinessName.Value; DataFactory.SqlDataBase().UpdateByHashtable("Restaurant", "ID", ddlRestaurant.SelectedValue, hss); } } else { ShowMsgHelper.AlertReloadClose("添加失败!", "ListGrid()"); } } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { string guid = CommonHelper.GetGuid; Hashtable ht = new Hashtable(); ht["IsAdmin"] = 1; ht["User_Name"] = User_Name.Value; ht["User_Account"] = User_Account.Value; if (User_Pwd.Value != "*************") { ht["User_Pwd"] = Md5Helper.MD5(User_Pwd.Value, 32); } ht["User_Sex"] = 1; ht["Email"] = ""; //联系电话 ht["Title"] = ""; ht["Theme"] = ""; //电子邮箱 ht["User_Remark"] = ""; //备注 ht["hotelid"] = "0"; ht["HotelListId"] = HotelListId.Value; ht["AdminHotelid"] = HotelAdmin.Value; ht["Credentials_Type"] = Credentials_Type.Value; ht["Credentials_Number"] = Credentials_Number.Value; if (!string.IsNullOrEmpty(hdUserId.Value)) { guid = hdUserId.Value; ht["ModifyDate"] = DateTime.Now; ht["ModifyUserId"] = RequestSession.GetSessionUser().UserId; ht["ModifyUserName"] = RequestSession.GetSessionUser().UserName; } else { StringBuilder sbPR = new StringBuilder(); sbPR.Append("SELECT User_Account FROM Base_UserInfo WHERE User_Account= @User_Account and AdminHotelid=@hotelid and DeleteMark=1"); SqlParam[] parmAdd = new SqlParam[] { new SqlParam("@User_Account", User_Account.Value), new SqlParam("@hotelid", HotelId.Value) }; DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sbPR, parmAdd); if (dt != null && dt.Rows.Count > 0) { ShowMsgHelper.Alert_Error("操作失败!用户名已存在"); return; } ht["User_ID"] = guid; ht["CreateUserId"] = RequestSession.GetSessionUser().UserId; ht["CreateUserName"] = RequestSession.GetSessionUser().UserName; ht["CreateDate"] = DateTime.Now; } ht["ModifyDate"] = DateTime.Now; ht["DeleteMark"] = 1; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", hdUserId.Value, ht); if (IsOk) { //#region ** 角色 ** //DataFactory.SqlDataBase().DeleteData("Base_UserRole", "User_ID", guid);//删除角色 //Hashtable htRole = new Hashtable(); //htRole["UserRole_ID"] = CommonHelper.GetGuid; //htRole["User_ID"] = guid; //htRole["Roles_ID"] = "0"; //DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserRole", "User_ID", "", htRole);//重新添加角色 //#endregion IsOk = this.add_ItemForm(checkbox_value.Value.Split(','), guid); } if (IsOk) { ShowMsgHelper.AlertReloadClose("操作成功!", "ListGrid(false)"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { string guid = CommonHelper.GetGuid; Hashtable ht = new Hashtable(); Hashtable ht_Notice = new Hashtable(); ht["IsAdmin"] = 2; ht["User_Name"] = User_Name.Value; ht["User_Account"] = User_Account.Value; //登录账号 ht["User_Phone"] = User_Account.Value; //手机号码 if (User_Pwd.Value != "*************") { if (User_Pwd.Value == "") { User_Pwd.Value = "123456"; } ht["User_Pwd"] = Md5Helper.MD5(User_Pwd.Value, 32); } ht["User_Sex"] = 1; ht["Email"] = ""; // 电子邮箱 ht["Title"] = ""; ht["Theme"] = ""; // ht["User_Remark"] = ""; //备注 ht["ygh"] = ygh.Value; //国光工号 ht["hotelid"] = HotelId.Value; ht["HotelListId"] = HotelId.Value; ht["AdminHotelid"] = AdminHotelid.Value; ht["Credentials_Type"] = Credentials_Type.Value; ht["Credentials_Number"] = Credentials_Number.Value; ht["RoomState"] = hdRoomState.Value; ht["HotelData"] = hdHotelData.Value; ht["Organization_ID"] = hdOrgId.Value; ht["PublicShow"] = hdPublicShow.Value; ht["ReserveMoney"] = hdReserveMoney.Value; if (!string.IsNullOrEmpty(hdUserId.Value) && string.IsNullOrEmpty(hRestore.Value)) { guid = hdUserId.Value; ht["ModifyDate"] = DateTime.Now; ht["ModifyUserId"] = RequestSession.GetSessionUser().UserId; ht["ModifyUserName"] = RequestSession.GetSessionUser().UserName; StringBuilder sbPR = new StringBuilder(); sbPR.Append("SELECT User_Account FROM Base_UserInfo WHERE User_Account= @User_Account and User_ID <> @User_ID and DeleteMark = 1"); SqlParam[] parmAdd = new SqlParam[] { new SqlParam("@User_Account", User_Account.Value), new SqlParam("@User_ID", hdUserId.Value) }; DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sbPR, parmAdd); if (dt != null && dt.Rows.Count > 0) { ShowMsgHelper.Alert_Error("操作失败!该员工手机号已存在"); return; } } else { StringBuilder sbPR = new StringBuilder(); sbPR.Append("SELECT User_Account FROM Base_UserInfo WHERE User_Account= @User_Account and (DeleteMark = 1 OR hotelid = @hotelid) and IsAdmin = 2"); SqlParam[] parmAdd = new SqlParam[] { new SqlParam("@User_Account", User_Account.Value), new SqlParam("@hotelid", HotelId.Value) }; DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sbPR, parmAdd); if (dt != null && dt.Rows.Count > 0) { ShowMsgHelper.Alert_Error("操作失败!该员工手机号已存在"); return; } ht["User_ID"] = guid; ht["CreateUserId"] = RequestSession.GetSessionUser().UserId; ht["CreateUserName"] = RequestSession.GetSessionUser().UserName; ht["CreateDate"] = DateTime.Now; } ht["ModifyDate"] = DateTime.Now; ht["DeleteMark"] = 1; bool IsOk; if (!string.IsNullOrEmpty(hRestore.Value)) { ht["User_Pwd"] = Md5Helper.MD5("123456", 32); IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", "", ht); } else { IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", hdUserId.Value, ht); } if (IsOk) { #region ** 角色 ** if (ddlUser_Role.SelectedValue != "-1") { DataFactory.SqlDataBase().DeleteData("Base_UserRole", "User_ID", guid);//删除角色 Hashtable htRole = new Hashtable(); htRole["UserRole_ID"] = CommonHelper.GetGuid; htRole["User_ID"] = guid; htRole["Roles_ID"] = ddlUser_Role.SelectedValue; DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserRole", "User_ID", "", htRole);//重新添加角色 } #endregion // IsOk = this.add_ItemForm(checkbox_value.Value.Split(','), guid); } if (IsOk) { ht_Notice["HotelData"] = hdHotelData.Value; DataFactory.SqlDataBase().Submit_AddOrEdit("Notice", "UserId", hdUserId.Value, ht_Notice); ShowMsgHelper.AlertReloadClose("操作成功!", "ListGrid(false)"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } }
/// <summary> /// 添加,修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSumit_Click(object sender, EventArgs e) { string BiginTime, EndinTime = null; if (hfEffectiveType.Value == "1") { BiginTime = DateTime.Now.ToString("yyyy-MM-dd"); EndinTime = DateTime.Now.AddYears(100).ToString("yyyy-MM-dd"); } else if (hfEffectiveType.Value == "2") { BiginTime = DateTime.Now.ToString("yyyy-MM-dd"); EndinTime = DateTime.Now.AddDays(Convert.ToDouble(txtDay.Value)).ToString("yyyy-MM-dd"); } else { BiginTime = B_sj.Value; EndinTime = E_sj.Value; } Hashtable hs = new Hashtable(); hs["CouponName"] = txtName.Value; hs["Par"] = Convert.ToInt32(txtPar.Value); hs["UsedMin"] = Convert.ToInt32(txtUsedMin.Value); hs["BiginTime"] = BiginTime; hs["EndinTime"] = EndinTime; hs["ServiceRange"] = sumhotel.Value; hs["ProductRange"] = txtInstructions.Value; hs["Mode"] = Convert.ToInt32(DDLmode.SelectedValue); hs["Membergrade"] = loadaddMembergrade(labelhtml.Value.ToString()); hs["FirstMoney"] = txtFirstMoney.Value; hs["SecondMoney"] = txtcz.Value; hs["IsEnable"] = hfsfqy.Value; hs["Isgiving"] = hfsfzs.Value; hs["hytype"] = hhytype.Value; hs["EffectiveType"] = hfEffectiveType.Value; hs["EffectiveDay"] = txtDay.Value; hs["AdminHotelid"] = RequestSession.GetSessionUser().AdminHotelid.ToString(); hs["yxrq"] = hyxrq.Value; hs["jjr"] = hjjr.Value; hs["count"] = txtNum.Value; hs["ishy"] = hishy.Value; hs["Is_Day_ok"] = hfIs_Day_ok.Value; hs["Total"] = txtTotal.Value; hs["Open_Hotel"] = HOpen_Hotel.Value; hs["ConsumptionType"] = HConsumptionType.Value; hs["TypeID"] = ddltype.SelectedValue; hs["BirthdaySendType"] = hdSendType.Value; if (hfdID.Value == "0") { //添加 int x = DataFactory.SqlDataBase().InsertByHashtableReturnPkVal("Coupon", hs); if (x <= 0) { ShowMsgHelper.Alert_Error("添加失败!"); } else { if (hfsfzs.Value == "1") { Gift(x); } //赠送优惠券 CommonMethod.Base_Log("添加", "Coupon", "", "优惠券管理", "添加[" + txtName.Value + "]"); //操作日志 ShowMsgHelper.AlertReloadClose("添加成功!", "ListGrid()"); } } else { //修改 if (DataFactory.SqlDataBase().UpdateByHashtable("Coupon", "ID", hfdID.Value, hs) <= 0) { ShowMsgHelper.Alert_Error("修改失败!"); } else { if (hfsfzs.Value == "1") { Gift(Convert.ToInt32(hfdID.Value)); } //赠送优惠券 CommonMethod.Base_Log("修改", "Coupon", hfdID.Value, "优惠券管理", "修改[" + txtName.Value + "]"); //操作日志 ShowMsgHelper.AlertReloadClose("修改成功!", "ListGrid()"); } } }