protected void Page_Load(object sender, EventArgs e) { // 관리자 체크 EmployeeInfo loginEmployee = new EmployeeInfo(); loginEmployee = (EmployeeInfo)Session["loginMember"]; if (loginEmployee == null) { Response.Redirect("~/login.aspx", true); } if (loginEmployee.ManagerLevel < 2) { Response.Redirect("~/login.aspx", true); } Office bll = new Office(); OfficeInfo office = new OfficeInfo(); office.OfficeCode = Convert.ToInt32(Request.QueryString["officeCode"]); int result = bll.deleteOffice(office); Response.Redirect("officeList.aspx", true); }
/// <summary> /// /// </summary> /// <param name="rdr"></param> /// <param name="obj"></param> /// <returns></returns> private OfficeInfo bindOffice(SqlDataReader rdr, OfficeInfo obj) { obj.OfficeCode = rdr.GetInt32(0); obj.OfficeName = rdr.GetString(1); obj.RegDate = rdr.GetDateTime(2); obj.Status = rdr.GetString(4); return(obj); }
public void SaveOfficeInformation([FromBody] OfficeInfo officeInfo, string practiceLocationId) { AccessControl.VerifyUserAccessToMultiLocationOffice(practiceLocationId); this.officeIt2Manager.SaveOfficeInformation(officeInfo); if (officeInfo.TaxDetails != null) { officeInfo.TaxDetails.ForEach(PracticeInformationManager.SaveTaxInformation); } }
protected void Page_Load(object sender, EventArgs e) { // 관리자 체크 EmployeeInfo loginEmployee = new EmployeeInfo(); loginEmployee = (EmployeeInfo)Session["loginMember"]; if (loginEmployee == null) { Response.Redirect("~/login.aspx", true); } if (loginEmployee.ManagerLevel < 2) { Response.Redirect("~/login.aspx", true); } if (Page.IsPostBack) { OfficeInfo office = new OfficeInfo(); office.OfficeCode = Convert.ToInt32(Request.QueryString["officeCode"]); office.OfficeName = txtOfficeName.Text; office.Status = txtStatus.Text; // 수정하기 sửa if (mode.Value.Equals("modify")) { int result = bll.updateOffice(office); Response.Redirect("officeList.aspx"); } // 등록하기 đăng ký else { int result = bll.insertOffice(office); Response.Redirect("officeList.aspx");; } } else { if (Request.QueryString["mode"].Equals("modify")) { OfficeInfo office = new OfficeInfo(); office = bll.selectOffice(Request.QueryString["officeCode"]); txtOfficeName.Text = office.OfficeName; txtStatus.Text = office.Status; lableCodeName.Text = " Sửa thông tin (정보 수정하기) : " + office.OfficeName; mode.Value = Request.QueryString["mode"]; } else { lableCodeName.Text = "Đăng ký (건물 등록하기)"; mode.Value = Request.QueryString["mode"]; } } }
/// <summary> /// update /// </summary> /// <param name="office"></param> /// <returns></returns> public int updateOffice(OfficeInfo office) { log.Debug("=================START updateOffice================="); log.Debug("office = " + office.ToString()); StringBuilder sql_update = new StringBuilder(); sql_update.Append("UPDATE Office SET officeName=N'" + office.OfficeName + "', status=N'" + office.Status + "' WHERE officeCode=" + office.OfficeCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_update.ToString(), null); log.Debug(@"=================END updateOffice================="); return(result); }
public ActionResult CreateOffice(string officename, string address, int empnumber) { var createoffice = new OfficeInfo() { OfficeName = officename, Address = address, OwnerId = WebSecurity.CurrentUserId, EmployeeNumber = empnumber }; dbContex.OfficeInfos.Add(createoffice); dbContex.SaveChanges(); return(RedirectToAction("EmployeeList")); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { OfficeInfo obj = (OfficeInfo)e.Row.DataItem; HyperLink colModify = (HyperLink)e.Row.Cells[2].Controls[0]; colModify.NavigateUrl = "officeEdit.aspx?officeCode=" + obj.OfficeCode + "&mode=modify"; colModify.ImageUrl = "~/images/icon/edit.gif"; HyperLink colDelete = (HyperLink)e.Row.Cells[3].Controls[0]; colDelete.NavigateUrl = "#"; colDelete.Attributes.Add("onclick", "return confirmDelete('officeDelete.aspx?officeCode=" + obj.OfficeCode + "');"); colDelete.ImageUrl = "~/images/icon/delete.gif"; } }
/// <summary> /// delete /// </summary> /// <param name="office"></param> /// <returns></returns> public int deleteOffice(OfficeInfo office) { log.Debug("=================START deleteOffice================="); log.Debug("office = " + office.ToString()); StringBuilder sql_delete = new StringBuilder(); //2010-12-21 김민우: 건물명 삭제시 FLAG값 변경으로 변경 //sql_delete.Append("DELETE FROM Office WHERE officeCode=" + office.OfficeCode); sql_delete.Append("UPDATE Office SET DEL_FLAG ='Y' WHERE officeCode=" + office.OfficeCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_delete.ToString(), null); log.Debug(@"=================END deleteOffice================="); return(result); }
/// <summary> /// insert /// </summary> /// <param name="office"></param> /// <returns></returns> public int insertOffice(OfficeInfo office) { log.Debug("=================START insertOffice================="); log.Debug("office = " + office.ToString()); StringBuilder sql_insert = new StringBuilder(); sql_insert.Append("INSERT INTO Office"); sql_insert.Append(" (officeName,regDate,status) "); sql_insert.Append(" VALUES "); sql_insert.Append(" (N'" + office.OfficeName + "',GETDATE(),N'" + office.Status + "')"); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_insert.ToString(), null); log.Debug(@"=================END insertOffice================="); return(result); }
/// <summary> /// list /// </summary> /// <param name="keyWord"></param> /// <param name="key"></param> /// <returns></returns> public List <OfficeInfo> selectOfficeList(string keyWord, string key) { log.Debug("=================START selectOfficeList================="); log.Debug("keyWord = " + keyWord); log.Debug("key = " + key); List <OfficeInfo> list = new List <OfficeInfo>(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM Office WHERE DEL_FLAG is null "); if (!String.IsNullOrEmpty(key)) { if (key.Equals("A")) { sql_select.Append("AND status = 'Y' "); } else { sql_select.Append("AND " + keyWord + " LIKE '%" + key + "%'"); } } sql_select.Append("ORDER BY officeName"); //Execute the query against the database using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { // Scroll through the results while (rdr.Read()) { OfficeInfo obj = new OfficeInfo(); obj = bindOffice(rdr, obj); list.Add(obj); } } log.Debug(@"=================END selectOfficeList================="); return(list); }
public List <TaskInfoVM> GetDoneWork(int currentUserId) { var officeInfo = new OfficeInfo(); var data = (from o in dbContex.OfficeInfos join t in dbContex.TaskInfos on o.Id equals t.OfficeId join u in dbContex.UserProfiles on t.EmployeeId equals u.UserId where t.TaskStatus && o.OwnerId == currentUserId select new TaskInfoVM() { Id = t.Id, EmployeeId = t.EmployeeId, TaskDescription = t.TaskDescription, OfficeName = o.OfficeName, TaskDeadline = t.TaskDeadline, TaskName = t.TaskName, EmployeeName = u.UserName, IsAccept = t.IsAccept }).ToList(); return(data); }
/// <summary> /// select /// </summary> /// <param name="officeCode"></param> /// <returns></returns> public OfficeInfo selectOffice(string officeCode) { log.Debug(@"=================START selectOffice================="); log.Debug(@"officeCode = " + officeCode); OfficeInfo obj = new OfficeInfo(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM Office WHERE officeCode=" + officeCode); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { if (rdr.Read()) { obj = bindOffice(rdr, obj); } } log.Debug(@"=================END selectOffice================="); return(obj); }
/// <summary> /// /// </summary> /// <param name="data"></param> /// <param name="collection"></param> /// <returns></returns> public static dynamic InsertNewOfficeInfo(OfficeInfo data, IMongoCollection <OfficeInfo> collection) { try { #region Create index //collection.Indexes.CreateOne("{ OfficeId: " + data.OfficeId + " }"); #endregion collection.InsertOne(data); return(true); } catch (Exception ex) { if (ex.Message.Contains("duplicate key error")) { return(ex.Message); } else { SL.CreateLog("MongoHelper", "InsertNewOfficeInfo", ex.Message); return(false); } } }
public int deleteOffice(OfficeInfo office) { return(dal.deleteOffice(office)); }
public int insertOffice(OfficeInfo office) { return(dal.insertOffice(office)); }
public int updateOffice(OfficeInfo office) { return(dal.updateOffice(office)); }
static void Main(string[] arguments) { ICommandLineParser commandLineParser = new PosixParser(); CommandLine commandLine = commandLineParser.Parse(Options, arguments); int port = SocketOpenOfficeConnection.DefaultPort; if (commandLine.HasOption(OptionPort.Opt)) { port = Convert.ToInt32(commandLine.GetOptionValue(OptionPort.Opt)); } String outputFormat = null; if (commandLine.HasOption(OptionOutputFormat.Opt)) { outputFormat = commandLine.GetOptionValue(OptionOutputFormat.Opt); } bool verbose = commandLine.HasOption(OptionVerbose.Opt); IDocumentFormatRegistry registry = new DefaultDocumentFormatRegistry(); String[] fileNames = commandLine.Args; if ((outputFormat == null && fileNames.Length != 2) || fileNames.Length < 1) { String syntax = "Convert [options] input-file output-file; or\n" + "[options] -f output-format input-file [input-file...]"; HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.PrintHelp(syntax, Options); Environment.Exit(ExitCodeTooFewArgs); } IOpenOfficeConnection connection = new SocketOpenOfficeConnection(port); OfficeInfo oo = EnvUtils.Get(); if (oo.Kind == OfficeKind.Unknown) { Console.Out.WriteLine("please setup OpenOffice or LibreOffice!"); return; } try { if (verbose) { Console.Out.WriteLine("-- connecting to OpenOffice.org on port " + port); } connection.Connect(); } catch (Exception) { string CmdArguments = string.Format("-headless -accept=\"socket,host={0},port={1};urp;\" -nofirststartwizard", SocketOpenOfficeConnection.DefaultHost, SocketOpenOfficeConnection.DefaultPort); if (!EnvUtils.RunCmd(oo.OfficeUnoPath, "soffice", CmdArguments)) { Console.Error.WriteLine("ERROR: connection failed. Please make sure OpenOffice.org is running and listening on port " + port + "."); Environment.Exit(ExitCodeConnectionFailed); } } try { IDocumentConverter converter = new OpenOfficeDocumentConverter(connection, registry); if (outputFormat == null) { FileInfo inputFile = new FileInfo(fileNames[0]); FileInfo outputFile = new FileInfo(fileNames[1]); ConvertOne(converter, inputFile, outputFile, verbose); } else { foreach (var t in fileNames) { var inputFile = new FileInfo(t); var outputFile = new FileInfo(inputFile.FullName.Remove(inputFile.FullName.LastIndexOf(".", StringComparison.Ordinal)) + "." + outputFormat); ConvertOne(converter, inputFile, outputFile, verbose); } } } finally { if (verbose) { Console.Out.WriteLine("-- disconnecting"); } connection.Disconnect(); } }
/// <summary> /// 房源编辑页面 /// </summary> /// <param name="posttype">信息类型 1 出售 2 求购 3 出租 4求租</param> /// <returns></returns> public ActionResult GetHouse(int posttype = 1, int buildingType = 1, int buildingId = 0, int editType = 0, int chouseId = 0, int cloneSuccess = 0) { ViewBag.ShowColned = cloneSuccess; PublicUserModel loginUser = this.GetLoginUser(); HouseModels houseModels = new HouseModels(); if (posttype < 1 || posttype > 4) { posttype = 1; } if (buildingType < 1 || buildingType > 5) { buildingType = 1; } ViewBag.Posttype = posttype; ViewBag.EditType = editType; ViewBag.ChouseId = chouseId; ViewBag.BuildingType = buildingType; ViewData["LoginUser"] = loginUser; if (cloneSuccess == 1) { return(View(houseModels)); } else { HouseBasicInfo houseBasicInfo = new HouseBasicInfo(); List <HouseImage> houseImages = new List <HouseImage>(); HouseInfo houseInfo = new HouseInfo(); VillaInfo villaInfo = new VillaInfo(); ShopInfo shopInfo = new ShopInfo(); OfficeInfo officeInfo = new OfficeInfo(); FactoryInfo factoryInfo = new FactoryInfo(); if (buildingId > 0) { houseBasicInfo = ncBase.CurrentEntities.HouseBasicInfo.Where(o => o.HouseID == buildingId && o.BuildType == buildingType && o.TradeType == posttype).FirstOrDefault(); byte bTradeType = BitConverter.GetBytes(posttype)[0]; if (houseBasicInfo.IsNull()) //房屋类型不匹配 或者发布类型不匹配 { houseBasicInfo = new HouseBasicInfo(); houseModels.HouseBasicInfo = houseBasicInfo; houseModels.HouseInfo = houseInfo; houseModels.HouseImages = houseImages; houseModels.VillaInfo = villaInfo; houseModels.ShopInfo = shopInfo; houseModels.OfficeInfo = officeInfo; houseModels.FactoryInfo = factoryInfo; return(View(houseModels)); } houseImages = ncBase.CurrentEntities.HouseImage.Where(o => o.HouseID == buildingId && o.Status == 1).ToList(); if (houseImages.IsNoNull()) { houseImages = houseImages.OrderBy(o => o.OrderID).ToList(); } switch (buildingType) { case (int)BuildingType.House: houseInfo = ncBase.CurrentEntities.HouseInfo.Where(o => o.HouseID.Equals(buildingId)).FirstOrDefault(); if (houseInfo.IsNull()) { houseInfo = new HouseInfo(); } break; case (int)BuildingType.Villa: villaInfo = ncBase.CurrentEntities.VillaInfo.Where(o => o.HouseID.Equals(buildingId)).FirstOrDefault(); if (villaInfo.IsNull()) { villaInfo = new VillaInfo(); } break; case (int)BuildingType.Shop: shopInfo = ncBase.CurrentEntities.ShopInfo.Where(o => o.HouseID.Equals(buildingId)).FirstOrDefault(); if (shopInfo.IsNull()) { shopInfo = new ShopInfo(); } break; case (int)BuildingType.Office: officeInfo = ncBase.CurrentEntities.OfficeInfo.Where(o => o.HouseID.Equals(buildingId)).FirstOrDefault(); if (officeInfo.IsNull()) { officeInfo = new OfficeInfo(); } break; case (int)BuildingType.Factory: factoryInfo = ncBase.CurrentEntities.FactoryInfo.Where(o => o.HouseID.Equals(buildingId)).FirstOrDefault(); if (factoryInfo.IsNull()) { factoryInfo = new FactoryInfo(); } break; } } if (string.IsNullOrEmpty(houseBasicInfo.InternalNum)) { houseBasicInfo.InternalNum = "WX" + DateTime.Now.ToString("yyyyMMdd") + StringUtility.GetValiCode(4); } houseModels.HouseBasicInfo = houseBasicInfo; houseModels.HouseInfo = houseInfo; houseModels.HouseImages = houseImages; houseModels.VillaInfo = villaInfo; houseModels.ShopInfo = shopInfo; houseModels.OfficeInfo = officeInfo; houseModels.FactoryInfo = factoryInfo; CommunityDetailModel result = new CommunityDetailModel(); List <RegionsModel> regionsList = regionBll.GetRegionList(loginUser.CityID); result.DistrctList = regionsList.FindAll(x => (x.Layer == 2)); result.RegionList = regionsList.FindAll(x => (x.Layer == 3)); ViewBag.RegionsModel = result; return(View(houseModels)); } }
public ActionResult OperateHouse(FormCollection form) { PublicUserModel loginUser = this.GetLoginUser(); #region 基本信息 int houseId = 0, buildingType, city, uid = loginUser.UserID; int.TryParse(form["houseId"], out houseId); //房源ID int.TryParse(form["buildingType"], out buildingType); //房屋类型 int tradeType; int.TryParse(form["postType"], out tradeType); //发布类型 int isChange = 0; int.TryParse(form["isChange"], out isChange); //表单是否被修改 int.TryParse(form["city"], out city); //城市ID int communityId; int.TryParse(form["cellCode"], out communityId); // 小区ID string communityName = form["cell"]; //小区名 int distrct; int.TryParse(form["distrct"], out distrct); //行政区 int region; int.TryParse(form["area"], out region); //路段 string address = form["addr"]; //地址 double buildArea, usedArea; double.TryParse(form["houseArea"], out buildArea); //建筑面积 double.TryParse(form["areaUsed"], out usedArea); //使用面积 if (usedArea > buildArea) { return(Content("建筑面积必须大于使用面积")); } int room, hall, kitchen, toilet, balcony; int.TryParse(form["room"], out room); //房 int.TryParse(form["hall"], out hall); //厅 int.TryParse(form["kitchen"], out kitchen); //厨房 int.TryParse(form["toilet"], out toilet); //卫生间 int.TryParse(form["balcony"], out balcony); //阳台 double price; double.TryParse(form["price"], out price); //价格 double lowpay = 0; //最低首付 string priceUnit; //价格单位 double unitPrice = 0; switch (tradeType) { case (int)TradeType.Sell: priceUnit = "万"; unitPrice = buildArea > 0 ? price * 10000 / buildArea : 0; //出售计算单价 lowpay = price * 10000 * 0.30; //最低首付计算 ; break; case (int)TradeType.Rent: switch (buildingType) { case (int)BuildingType.House: case (int)BuildingType.Villa: priceUnit = "元/月"; break; default: priceUnit = form["priceType"]; break; } break; default: priceUnit = form["priceType"]; break; } string payType = form["payType"].IsNoNull() ? form["payType"] : ""; //支付方式 int usedYear = 0; int.TryParse(form["ddlUsedYear"], out usedYear); //建造年代 Int16 curFloor = 0; Int16.TryParse(form["curFloor"], out curFloor); //所在楼层 Int16 maxFloor = 0; Int16.TryParse(form["maxFloor"], out maxFloor); //总层数 if (curFloor > maxFloor) { return(Content("总层数必须大于所在楼层")); } string pointTo = form["pointTo"]; //朝向 string lookTime = form["lookTime"]; //看房时间 string fitmentStatus = form["fitmentStatus"]; //装修程度 string internalNum = form["internalNum"]; //内部编号 string cellLabel = form["cellLabel"]; //小区特色 string houseLabel = form["houseLabel"]; //房源标签 string yijuhua = form["yijuhua"]; //一句话广告 string video = form["video"]; //视频 string title = form["title"].IsNoNull() ? form["title"] : communityName; //房源标题 string contacts = form["contacts"].IsNoNull() ? form["contacts"] : loginUser.NickName; //委托人 string tel = form["tel"].IsNoNull() ? form["tel"] : loginUser.Tel; //委托人联系方式 string houseDescribe = form["houseDescribe"]; //房源描述 string imgUrlCover = ""; //房源图封面 string imgUrl = form["imgUrl"].IsNoNull() ? form["imgUrl"] : ""; //房源图 string imageType = form["imageType"].IsNoNull() ? form["imageType"] : ""; //房源图类型 string imgDescribe = "," + (form["imgDescribe"].IsNoNull()? form["imgDescribe"] : ""); //房源图说明 string[] imgUrlLists = imgUrl.Split(','); string[] imageTypeLists = imageType.Split(','); string[] imgDescribeLists = imgDescribe.Split(','); if (imgUrlLists.Length > 0 && string.IsNullOrEmpty(imgUrlCover)) { imgUrlCover = imgUrlLists[0]; } // return JsonReturnValue(new { Message = imgUrl + " | " + imageType + " | " + imgDescribe + " | " + imgUrlCover + " | " + imageTypeCover + " | " + imgDescribeCover, id = houseId, }, JsonRequestBehavior.AllowGet); HouseBasicInfo houseBasicInfo = new HouseBasicInfo(); if (houseId < 1) { return(Content("管理后台不能发布房源")); } houseBasicInfo = ncBase.CurrentEntities.HouseBasicInfo.Where(o => o.HouseID == houseId).FirstOrDefault(); if (houseBasicInfo.IsNull()) { return(Content("该房源不存在")); } houseBasicInfo.TradeType = BitConverter.GetBytes(tradeType)[0]; houseBasicInfo.CityID = city; houseBasicInfo.Distrctid = distrct; houseBasicInfo.RegionID = region; houseBasicInfo.CommunityID = communityId; houseBasicInfo.CommunityName = communityName; houseBasicInfo.BuildType = BitConverter.GetBytes(buildingType)[0]; houseBasicInfo.BuildArea = Convert.ToDecimal(buildArea); houseBasicInfo.UsedArea = Convert.ToDecimal(usedArea);; houseBasicInfo.PointTo = pointTo; houseBasicInfo.UnitPrice = Convert.ToDecimal(unitPrice); houseBasicInfo.Price = Convert.ToDecimal(price); houseBasicInfo.PriceUnit = priceUnit; houseBasicInfo.CurFloor = curFloor; houseBasicInfo.MaxFloor = maxFloor; houseBasicInfo.UsedYear = usedYear; houseBasicInfo.ExpireDay = DateTime.Now.AddDays(30); houseBasicInfo.FitmentStatus = fitmentStatus; int picNum = imgUrlLists.Length > 1 ? imgUrlLists.Length - 1 : 0; houseBasicInfo.PicNum = BitConverter.GetBytes(picNum)[0]; houseBasicInfo.Title = title; houseBasicInfo.Note = houseDescribe; houseBasicInfo.Status = BitConverter.GetBytes((int)HouseStatus.Release)[0]; houseBasicInfo.IP = IpUtility.GetIp(); houseBasicInfo.PostTime = DateTime.Now; houseBasicInfo.Address = address; houseBasicInfo.LookHouseTime = lookTime; houseBasicInfo.HouseLabel = houseLabel; houseBasicInfo.InternalNum = internalNum; houseBasicInfo.CellLabel = cellLabel; houseBasicInfo.YiJuHua = yijuhua; houseBasicInfo.Room = BitConverter.GetBytes(room)[0]; houseBasicInfo.Hall = BitConverter.GetBytes(hall)[0]; houseBasicInfo.Kitchen = BitConverter.GetBytes(kitchen)[0]; houseBasicInfo.Toilet = BitConverter.GetBytes(toilet)[0]; houseBasicInfo.Balcony = BitConverter.GetBytes(balcony)[0]; houseBasicInfo.PayType = payType; houseBasicInfo.HouseImgPath = imgUrlCover; houseBasicInfo.LowPay = Convert.ToDecimal(lowpay); houseBasicInfo.Tel = tel; houseBasicInfo.Contacts = contacts; houseBasicInfo.Video = video; if (houseId.Equals(0)) //添加操作时候 { houseBasicInfo.Tag = ""; houseBasicInfo.AddDate = DateTime.Now; houseBasicInfo.PushTime = Convert.ToDateTime("1900-1-1"); houseBasicInfo.DeleteTime = Convert.ToDateTime("1900-1-1"); ncBase.CurrentEntities.AddToHouseBasicInfo(houseBasicInfo); } ncBase.CurrentEntities.SaveChanges(); houseId = houseBasicInfo.HouseID; #endregion #region 添加房源图片 if (imgUrlLists.Length > 0 && imgUrlLists.Length == imageTypeLists.Length && (imgUrlLists.Length == imgDescribeLists.Length) && isChange == 1) { HouseBll houseBll = new HouseBll(); houseBll.DelHouseImageByHouseID(houseId, uid); for (int i = 0; i < imgUrlLists.Length; i++) { bool value = false; if (imgUrlLists.Length > 1) { for (int j = i + 1; j < imgUrlLists.Length; j++) { if (i != j && imgUrlLists[i] == imgUrlLists[j]) { value = true; } } } if (value == false && !string.IsNullOrEmpty(imgUrlLists[i])) { bool isCover = false; if (imgUrlCover == imgUrlLists[i]) { isCover = true; } HouseImage houseImage = new HouseImage(); houseImage.HouseID = houseId; houseImage.ImagePath = imgUrlLists[i]; houseImage.ImagePos = imgDescribeLists[i]; houseImage.ImageType = HouseUtility.GetHouseImgType(imageTypeLists[i]); houseImage.IsCover = isCover; houseImage.OrderID = i; houseImage.CommunityID = communityId; houseImage.UserID = uid; houseImage.AddTime = DateTime.Now; houseImage.Status = BitConverter.GetBytes(1)[0];; ncBase.CurrentEntities.AddToHouseImage(houseImage); ncBase.CurrentEntities.SaveChanges(); } } } #endregion bool isAdd = false; #region 房屋类型扩展信息 switch (buildingType) { case (int)BuildingType.House: #region 住宅信息 string basicEquipHouse = form["basicEquip"].IsNoNull() ? form["basicEquip"] : ""; //住宅基础设施 string houseType = form["houseType"].IsNoNull() ? form["houseType"] : ""; //房屋类别 string houseSubType = form["houseSubType"].IsNoNull() ? form["houseSubType"] : ""; //住宅子类型 string houseProperty = form["houseProperty"].IsNoNull() ? form["houseProperty"] : ""; //房屋产权 string landYear = form["landYear"].IsNoNull() ? form["landYear"] : ""; //产权年限 string houseStructure = form["houseStructure"].IsNoNull() ? form["houseStructure"] : ""; //房屋结构 bool fiveYears = form["fiveYears"].IsNoNull() && form["fiveYears"] == "1"; //产证满二 bool onlyHouse = form["onlyHouse"].IsNoNull() && form["onlyHouse"] == "1"; //唯一住房 string advEquip = form["advEquip"].IsNoNull() ? form["advEquip"] : ""; //配套设施 HouseInfo houseInfo = ncBase.CurrentEntities.HouseInfo.Where(o => o.HouseID.Equals(houseId)).FirstOrDefault(); if (houseInfo.IsNull()) { houseInfo = new HouseInfo(); isAdd = true; //标记为新增加 } houseInfo.HouseID = houseId; houseInfo.HouseType = houseType; houseInfo.HouseSubType = houseSubType; houseInfo.HouseProperty = houseProperty; houseInfo.LandYear = landYear; houseInfo.HouseStructure = houseStructure; houseInfo.FiveYears = fiveYears; houseInfo.OnlyHouse = onlyHouse; houseInfo.BasicEquip = basicEquipHouse; houseInfo.AdvEquip = advEquip; if (isAdd) { ncBase.CurrentEntities.AddToHouseInfo(houseInfo); } ncBase.CurrentEntities.SaveChanges(); #endregion break; case (int)BuildingType.Villa: #region 别墅信息 string villaType = form["villaType"].IsNoNull() ? form["villaType"] : ""; //别墅形式 string hallType = form["hallType"].IsNoNull() ? form["hallType"] : ""; //厅结构 string landYear2 = form["landYear2"].IsNoNull() ? form["landYear2"] : ""; //产权年限 bool fiveYears2 = form["fiveYears2"].IsNoNull() && form["fiveYears2"] == "1"; //产证满二 bool onlyHouse2 = form["onlyHouse2"].IsNoNull() && form["onlyHouse2"] == "1"; //唯一住房 bool basement = form["basement"].IsNoNull() && form["basement"] == "1"; //地下室 bool garden = form["garden"].IsNoNull() && form["garden"] == "1"; //花园 bool garage = form["garage"].IsNoNull() && form["garage"] == "1"; //车库 bool parkLot = form["parkLot"].IsNoNull() && form["parkLot"] == "1"; //停车位 string basicEquip1 = form["basicEquip1"].IsNoNull() ? form["basicEquip1"] : ""; //配套设施 string advEquip1 = form["advEquip1"].IsNoNull() ? form["advEquip1"] : ""; //室内设施 VillaInfo villaInfo = ncBase.CurrentEntities.VillaInfo.Where(o => o.HouseID.Equals(houseId)).FirstOrDefault(); if (villaInfo.IsNull()) { villaInfo = new VillaInfo(); isAdd = true; //标记为新增加 } villaInfo.HouseID = houseId; villaInfo.VillaType = villaType; villaInfo.HallType = hallType; villaInfo.LandYear = landYear2; villaInfo.OnlyHouse = onlyHouse2; villaInfo.FiveYears = fiveYears2; villaInfo.Basement = basement; villaInfo.Garden = garden; villaInfo.Garage = garage; villaInfo.ParkLot = parkLot; villaInfo.BasicEquip = basicEquip1; villaInfo.AdvEquip = advEquip1; if (isAdd) { ncBase.CurrentEntities.AddToVillaInfo(villaInfo); } ncBase.CurrentEntities.SaveChanges(); #endregion break; case (int)BuildingType.Shop: #region 商铺信息 string shopType = form["shopType"].IsNoNull() ? form["shopType"] : "";; //商铺类型 string shopStatus = form["shopStatus"].IsNoNull() ? form["shopStatus"] : "";; //商铺状态 string targetField = form["targetField"].IsNoNull() ? form["targetField"] : "";; //目标业态 decimal feeShop; decimal.TryParse(form["fee2"], out feeShop); //物业费 bool divideShop = form["divide2"].IsNoNull() && form["divide2"] == "1"; //是否分割 string basicEquip2 = form["basicEquip2"].IsNoNull() ? form["basicEquip2"] : ""; //配套设施 ShopInfo shopInfo = ncBase.CurrentEntities.ShopInfo.Where(o => o.HouseID.Equals(houseId)).FirstOrDefault(); if (shopInfo.IsNull()) { shopInfo = new ShopInfo(); isAdd = true; //标记为新增加 } shopInfo.HouseID = houseId; shopInfo.ShopType = shopType; shopInfo.ShopStatus = shopStatus; shopInfo.TargetField = targetField; shopInfo.Fee = feeShop; shopInfo.Divide = divideShop; shopInfo.BasicEquip = basicEquip2; if (isAdd) { ncBase.CurrentEntities.AddToShopInfo(shopInfo); } ncBase.CurrentEntities.SaveChanges(); #endregion break; case (int)BuildingType.Office: #region 写字楼信息 string officeType = form["officeType"].IsNoNull() ? form["officeType"] : ""; //写字楼类别 string officeLevel = form["officeLevel"].IsNoNull() ? form["officeLevel"] : ""; //写字楼级别 decimal fee3; decimal.TryParse(form["fee3"], out fee3); //物业费 bool divide3 = form["divide3"].IsNoNull() && form["divide3"] == "1"; //是否分割 string basicEquip3 = form["basicEquip3"].IsNoNull() ? form["basicEquip3"] : ""; //配套设施 OfficeInfo officeInfo = ncBase.CurrentEntities.OfficeInfo.Where(o => o.HouseID.Equals(houseId)).FirstOrDefault(); if (officeInfo.IsNull()) { officeInfo = new OfficeInfo(); isAdd = true; //标记为新增加 } officeInfo.HouseID = houseId; officeInfo.OfficeType = officeType; officeInfo.OfficeLevel = officeLevel; officeInfo.BasicEquip = basicEquip3; officeInfo.Fee = fee3; officeInfo.Divide = divide3; if (isAdd) { ncBase.CurrentEntities.AddToOfficeInfo(officeInfo); } ncBase.CurrentEntities.SaveChanges(); #endregion break; case (int)BuildingType.Factory: #region 厂房信息 string factoryType = form["factoryType"].IsNoNull() ? form["factoryType"] : ""; //厂房类别 string basicEquip4 = form["basicEquip4"].IsNoNull() ? form["basicEquip4"] : ""; //基础设施 FactoryInfo factoryInfo = ncBase.CurrentEntities.FactoryInfo.Where(o => o.HouseID.Equals(houseId)).FirstOrDefault(); if (factoryInfo.IsNull()) { factoryInfo = new FactoryInfo(); isAdd = true; //标记为新增加 } factoryInfo.HouseID = houseId; factoryInfo.BasicEquip = basicEquip4; factoryInfo.FactoryType = factoryType; if (isAdd) { ncBase.CurrentEntities.AddToFactoryInfo(factoryInfo); } ncBase.CurrentEntities.SaveChanges(); #endregion break; } #endregion return(RedirectToAction("GetHouseMainView", new { posttype = tradeType, buildType = buildingType })); // return JsonReturnValue(new { Message = "房源提交成功", id = houseId, }, JsonRequestBehavior.AllowGet); }
public ActionResult InsertOfficeInfo([FromBody] OfficeInfo data, string username) { try { if (data != null && username != null) { var checkOffice = MH.GetSingleObject(officeinfo_collection, "OfficeName", data.OfficeName, "Address", data.Address).Result; if (checkOffice != null) { var officeInfo = BsonSerializer.Deserialize <OfficeInfo>(checkOffice); if (officeInfo.IsActive == true) { return(BadRequest(new ResponseData { Code = "401", Message = "Office with same office name and address is already added" })); } else { var updateDefinition = Builders <BsonDocument> .Update.Set("IsActive", true); update = MH.UpdateSingleObject(officeinfo_collection, "OfficeName", data.OfficeName, "Address", data.Address, updateDefinition); var detail = officeInfo; detail.IsActive = true; AL.CreateLog(username, "InsertOfficeInfo", officeInfo, detail, activitylog_collection); return(BadRequest(new ResponseData { Code = "402", Message = "Office already added and its made active" })); } } else { #region Calculate office id var getOffices = MH.GetListOfObjects(officeinfo_collection, null, null, null, null).Result; if (getOffices.Count == 0) { data.OfficeId = "OF-1"; } else { List <long> idList = new List <long>(); foreach (var office in getOffices) { OfficeInfo officeInfo = BsonSerializer.Deserialize <OfficeInfo>(office); long seperatedId = Convert.ToInt64(officeInfo.OfficeId.Substring(officeInfo.OfficeId.LastIndexOf('-') + 1)); idList.Add(seperatedId); } var maxId = idList.Max(); data.OfficeId = "OF-" + (maxId + 1); #endregion } data.IsActive = true; var insert = MH.InsertNewOfficeInfo(data, officeinfoCollection); if (insert == true) { AL.CreateLog(username, "InsertOfficeInfo", null, data, activitylog_collection); return(Ok(new ResponseData { Code = "200", Message = "Inserted", Data = data })); } else if (insert == false) { return(BadRequest(new ResponseData { Code = "403", Message = "Office info with same id is already added" })); } else { return(BadRequest(new ResponseData { Code = "400", Message = "Failed", Data = insert })); } } } else { return(BadRequest(new ResponseData { Code = "405", Message = "Bad Request" })); } } catch (Exception ex) { SL.CreateLog("OfficeController", "InsertOfficeInfo", ex.Message); return(BadRequest(new ResponseData { Code = "400", Message = "Failed", Data = ex.Message })); } }
public async Task OfficeInfoList_Get() { await Assert.ThrowsAsync <DataPortalException>(() => OfficeInfo.GetOfficeInfo(999)); }