public object GetSQM() { using (var dbc = new DBConnection()) { string sql = "select UserName from aspnet_Users where UserId=" + SystemUser.CurrentUser.UserID; string username = dbc.ExecuteScalar(sql).ToString(); using (SmartFramework4v2.Data.MySql.DBConnection db = new SmartFramework4v2.Data.MySql.DBConnection(ConfigurationManager.ConnectionStrings["DzfConnStr"].ConnectionString)) { sql = "select DealerAuthoriCode from tb_b_landlord where LoginName='" + username + "'"; DataTable dt = db.ExecuteDataTable(sql); return(dt); } } }
public object GetManagerList(int pagnum, int pagesize) { using (SmartFramework4v2.Data.MySql.DBConnection dbc = new SmartFramework4v2.Data.MySql.DBConnection(ConfigurationManager.ConnectionStrings["DzfConnStr"].ConnectionString)) { try { int cp = pagnum; int ac = 0; string UserName = GetUserName(); string sql = "select * from tb_b_manager where UserName='******' and State=0"; System.Data.DataTable dtPage = new System.Data.DataTable(); dtPage = dbc.GetPagedDataTable(sql, pagesize, ref cp, out ac); return(new { dt = dtPage, cp = cp, ac = ac }); } catch (Exception ex) { throw ex; } } }
public object SaveHotel(JSReader jsr, JSReader file, JSReader tagIds, JSReader tagValues, string imgs) { using (DBConnection dbc = new DBConnection()) { dbc.BeginTransaction(); try { int HotelId; string ID = jsr["ID"].ToString(); string HotelName = jsr["HotelName"].ToString(); string HotelNo = jsr["HotelNo"].ToString(); string Mobile = jsr["Mobile"].ToString(); string Tel = jsr["Tel"].ToString(); string DetailAddress = jsr["DetailAddress"].ToString(); string Province = jsr["Province"].ToString(); string City = jsr["City"].ToString(); string County = jsr["County"].ToString(); string CompleteAddress = Province + City + County + DetailAddress; string Lat = jsr["Lat"].ToString(); string Lng = jsr["Lng"].ToString(); string ServiceInfo = jsr["ServiceInfo"].ToString(); int HourRoomTimeLong = 0; int HourRoomTimeLong2 = 0; int HourRoomTimeLong3 = 0; int CheckinHour = 0; int CheckinMinute = 0; int CheckoutHour = 0; int CheckoutMinute = 0; float MonthRentPrice = 0; float DepositPriceByMonth = 0; int JSCycle = 0; string AlipayAccount = jsr["AlipayAccount"].ToString(); string LiableAccount = jsr["LiableAccount"].ToString(); string CleanerAccount = jsr["CleanerAccount"].ToString(); string DecRemark = jsr["DecRemark"].ToString(); string ConsumeRule = jsr["ConsumeRule"].ToString(); int IsHasWeekendPrice = jsr["IsHasWeekendPrice"].ToInteger(); int WeekendConatin5 = jsr["WeekendConatin5"].ToInteger(); int WeekendConatin6 = jsr["WeekendConatin6"].ToInteger(); int WeekendConatin7 = jsr["WeekendConatin7"].ToInteger(); int IsOpenDayRent = jsr["IsOpenDayRent"].ToInteger(); int IsOpenHourRent = jsr["IsOpenHourRent"].ToInteger(); int IsOpenMonthRent = jsr["IsOpenMonthRent"].ToInteger(); int ManagementMode = jsr["ManagementMode"].ToInteger(); int IsAutoAccept = jsr["IsAutoAccept"].ToInteger(); int HandlerKind = jsr["HandlerKind"].ToInteger(); int JsPlatSel = jsr["JsPlatSel"].ToInteger(); if (jsr["HourRoomTimeLong"].ToString() != "") { HourRoomTimeLong = jsr["HourRoomTimeLong"].ToInteger(); } if (jsr["HourRoomTimeLong2"].ToString() != "") { HourRoomTimeLong2 = jsr["HourRoomTimeLong2"].ToInteger(); } if (jsr["HourRoomTimeLong3"].ToString() != "") { HourRoomTimeLong3 = jsr["HourRoomTimeLong3"].ToInteger(); } if (jsr["CheckinHour"].ToString() != "") { CheckinHour = jsr["CheckinHour"].ToInteger(); } if (jsr["CheckinMinute"].ToString() != "") { CheckinMinute = jsr["CheckinMinute"].ToInteger(); } if (jsr["CheckoutHour"].ToString() != "") { CheckoutHour = jsr["CheckoutHour"].ToInteger(); } if (jsr["CheckoutMinute"].ToString() != "") { CheckoutMinute = jsr["CheckoutMinute"].ToInteger(); } if (jsr["MonthRentPrice"].ToString() != "") { MonthRentPrice = jsr["MonthRentPrice"].ToSingle(); } if (jsr["DepositPriceByMonth"].ToString() != "") { DepositPriceByMonth = jsr["DepositPriceByMonth"].ToSingle(); } if (jsr["JSCycle"].ToString() != "") { JSCycle = jsr["JSCycle"].ToInteger(); } float DepositPrice = 0; if (jsr["DepositPrice"].ToString() != "") { DepositPrice = jsr["DepositPrice"].ToSingle(); } var dtHotel = dbc.GetEmptyDataTable("Lock_HotelApply"); var drHotel = dtHotel.NewRow(); DataTableTracker dtt = new DataTableTracker(dtHotel); drHotel["HotelName"] = HotelName; drHotel["HotelNo"] = HotelNo; drHotel["Mobile"] = Mobile; drHotel["Tel"] = Tel; drHotel["DetailAddress"] = DetailAddress; drHotel["Province"] = Province; drHotel["City"] = City; drHotel["County"] = County; drHotel["CompleteAddress"] = CompleteAddress; drHotel["Lat"] = Lat; drHotel["Lng"] = Lng; drHotel["ServiceInfo"] = ServiceInfo; drHotel["HourRoomTimeLong"] = HourRoomTimeLong; drHotel["HourRoomTimeLong2"] = HourRoomTimeLong2; drHotel["HourRoomTimeLong3"] = HourRoomTimeLong3; drHotel["CheckinHour"] = CheckinHour; drHotel["CheckinMinute"] = CheckinMinute; drHotel["CheckoutHour"] = CheckoutHour; drHotel["CheckoutMinute"] = CheckoutMinute; drHotel["MonthRentPrice"] = MonthRentPrice; drHotel["JSCycle"] = JSCycle; drHotel["AlipayAccount"] = AlipayAccount; drHotel["LiableAccount"] = LiableAccount; drHotel["CleanerAccount"] = CleanerAccount; drHotel["DecRemark"] = DecRemark; drHotel["ConsumeRule"] = ConsumeRule; drHotel["IsHasWeekendPrice"] = IsHasWeekendPrice; drHotel["WeekendConatin5"] = WeekendConatin5; drHotel["WeekendConatin6"] = WeekendConatin6; drHotel["WeekendConatin7"] = WeekendConatin7; drHotel["IsOpenDayRent"] = IsOpenDayRent; drHotel["IsOpenHourRent"] = IsOpenHourRent; drHotel["IsOpenMonthRent"] = IsOpenMonthRent; drHotel["JsPlatSel"] = JsPlatSel; drHotel["DepositPrice"] = DepositPrice; drHotel["ManagementMode"] = ManagementMode; drHotel["IsAutoAccept"] = IsAutoAccept; drHotel["HandlerKind"] = HandlerKind; drHotel["DepositPriceByMonth"] = DepositPriceByMonth; drHotel["UserId"] = SystemUser.CurrentUser.UserID; drHotel["UserName"] = SystemUser.CurrentUser.UserName; drHotel["SHZT"] = 1; //for (int i = 1; i < 6; i++) //{ // if (file.ToArray().Length >= i) // drHotel["Image" + i] = file.ToArray()[i - 1].ToString(); // else // drHotel["Image" + i] = ""; //} if (!string.IsNullOrEmpty(imgs)) { string[] imglist = imgs.Split(new char[] { ',' }); for (int i = 1; i < 6; i++) { if (imglist.Count() >= i) { string newfilename = GetNewFilePath(imglist[i - 1], "~/files/Hotel/"); drHotel["Image" + i] = newfilename.Substring(2, newfilename.Length - 2); } else { drHotel["Image" + i] = ""; } } } else { for (int i = 1; i < 6; i++) { drHotel["Image" + i] = ""; } } if (ID == "") { HotelId = Convert.ToInt16(dbc.ExecuteScalar("SELECT IDENT_CURRENT('Lock_HotelApply') + IDENT_INCR('Lock_HotelApply')").ToString()); drHotel["CreateDate"] = DateTime.Now; dtHotel.Rows.Add(drHotel); dbc.InsertTable(drHotel); } else { HotelId = Convert.ToInt16(ID); drHotel["ID"] = Convert.ToInt16(ID); drHotel["UpdateDate"] = DateTime.Now; dtHotel.Columns["ID"].ReadOnly = false; dtHotel.Rows.Add(drHotel); dbc.UpdateTable(dtHotel, dtt); } dbc.ExecuteNonQuery("delete from Lock_ApplyTag where PID=" + HotelId + " and ZDLX=1"); DataTable dtTag = dbc.GetEmptyDataTable("Lock_ApplyTag"); for (int i = 0; i < tagIds.ToArray().Length; i++) { DataRow drTag = dtTag.NewRow(); drTag["ZDBID"] = Convert.ToInt16(tagIds.ToArray()[i].ToString()); drTag["ZDLX"] = 1; drTag["VALUE"] = tagValues.ToArray()[i]; drTag["PID"] = HotelId; dtTag.Rows.Add(drTag); } dbc.InsertTable(dtTag); using (SmartFramework4v2.Data.MySql.DBConnection db = new SmartFramework4v2.Data.MySql.DBConnection(ConfigurationManager.ConnectionStrings["DzfConnStr"].ConnectionString)) { db.BeginTransaction(); try { int flowId = Flow.SetFlow(db, HotelId.ToString(), "门店申请"); Flow.SetStep(db, flowId, 1, "经济人审核", 28, ""); db.CommitTransaction(); } catch (Exception ex) { db.RoolbackTransaction(); throw ex; } } dbc.CommitTransaction(); return(true); } catch (Exception ex) { dbc.RoolbackTransaction(); throw ex; } } }