Exemple #1
0
        public IActionResult AddProjectType(int projectTypeId, string operationType)
        {
            var model = new ProjectTypeModel(projectTypeId, operationType, _projectTypeService);

            _session.SetString("OperationType", operationType);
            return(PartialView("_AddProjectType", model));
        }
        public string SaveProjectType(ProjectTypeModel project)
        {
            project.CrBy   = User.Identity.Name;
            project.CrDate = DateTime.Now;
            int i = pservice.AddProjectType(project);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(i));
        }
Exemple #3
0
 public ActionResult ProjectTypeEntry(ProjectTypeModel projectTypeModel)
 {
     if (string.IsNullOrWhiteSpace(projectTypeModel.Mode))
     {
         projectTypeModel.Mode = "New";
     }
     return(View(projectTypeModel));
 }
Exemple #4
0
        public async Task <IActionResult> AddProjectType(ProjectTypeModel model)
        {
            try
            {
                var    OperationType = _session.GetString("OperationType");
                var    projectType   = new ProjectType();
                string mesaj         = "";

                //Yeni Kayıt İse ekle
                if (OperationType == Constants.OperationType.Insert)
                {
                    #region ProjectType Sistemde Var Mı Kontrolü
                    projectType = await _projectTypeService.SingleOrDefaultAsync(x => x.Name == model.Name || x.Code == model.Code && x.IsDeleted == false);

                    if (projectType != null)
                    {
                        return(Json(new JsonMessage {
                            HataMi = true, Baslik = "İşlem Başarısız", Mesaj = "Eklemek istediğiniz özelliklere sahip projectType sistemde zaten mevcut."
                        }));
                    }
                    #endregion

                    #region ProjectType Ekle
                    projectType = new ProjectType
                    {
                        Name      = model.Name,
                        Code      = model.Code,
                        IsDeleted = false
                    };
                    await _projectTypeService.AddAsync(projectType);

                    mesaj = "Yeni ProjectType Başarıyle Eklendi.";
                    #endregion
                }
                if (OperationType == Constants.OperationType.Update)
                {
                    #region Update İşlemi
                    projectType = await _projectTypeService.GetByIdAsync(model.Id);

                    projectType.Name = model.Name;
                    projectType.Code = model.Code;
                    _projectTypeService.Update(projectType);
                    mesaj = "Yeni ProjectType Başarıyle Güncellendi.";
                    #endregion
                }

                return(Json(new JsonMessage {
                    HataMi = false, Baslik = "İşlem Başarılı", Mesaj = mesaj
                }));
            }
            catch (Exception ex)
            {
                return(Json(new JsonMessage {
                    HataMi = true, Baslik = "İşlem Başarısız", Mesaj = "İşlem Sırasında Hata Oluştu."
                }));
            }
        }
 public string ProjectTypeCUD(ProjectTypeModel projectTypeModel)
 {
     cKMDL.UseTran               = true;//ssa chg 09_06_2021
     projectTypeModel.Sqlprms    = new SqlParameter[4];
     projectTypeModel.Sqlprms[0] = new SqlParameter("@ProjectTypeCD", projectTypeModel.ProjectTypeCD);
     projectTypeModel.Sqlprms[1] = new SqlParameter("@ProjectTypeName", projectTypeModel.ProjectTypeName);
     projectTypeModel.Sqlprms[2] = new SqlParameter("@UpdatedBy", projectTypeModel.UpdatedBy);
     projectTypeModel.Sqlprms[3] = new SqlParameter("@Mode", projectTypeModel.Mode);
     return(cKMDL.InsertUpdateDeleteData("ProjectType_CUD", ff.GetConnectionWithDefaultPath("PJMS"), projectTypeModel.Sqlprms));
 }
Exemple #6
0
 public List <ProjectTypeModel> Get(ProjectTypeModel filter)
 {
     using (var db = new EGULFEntities())
     {
         return((from ct in db.ProjectType
                 where ct.ProjectTypeId == filter.ProjectTypeId ||
                 filter.ProjectTypeId == null
                 select new ProjectTypeModel
         {
             ProjectTypeId = ct.ProjectTypeId,
             Name = ct.Name,
             Acronym = ct.Acronym,
             Category = ct.Category
         }).OrderBy(x => x.Acronym).ToList());
     }
 }
        public JsonResult SaveProjectType(ProjectTypeModel model)
        {
            ProjectType currentProjectType;

            if (model.Id > 0)
            {
                currentProjectType = _tmcService.GetProjectType(model.Id);
                TypeAdapter.Adapt <ProjectTypeModel, ProjectType>(model, currentProjectType);
                _tmcService.UpdateProjectType(currentProjectType);
            }
            else
            {
                currentProjectType = model.ToEntity();
                _tmcService.AddProjectType(currentProjectType);
            }

            return(Json(true));
        }
Exemple #8
0
 public int AddProjectType(ProjectTypeModel model)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         try
         {
             Mapper.CreateMap <ProjectTypeModel, ProjectType>();
             var mdl = Mapper.Map <ProjectTypeModel, ProjectType>(model);
             context.ProjectTypes.Add(mdl);
             int i = context.SaveChanges();
             return(i);
         }
         catch (Exception ex)
         {
             Helper hp = new Helper();
             hp.LogException(ex);
             return(0);
         }
     }
 }
        public string EditProjectType(ProjectTypeModel pmodel)
        {
            int i = pservice.EditProjectType(pmodel);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(i));
        }
Exemple #10
0
        private async void Init()
        {
            await viewModel.LoadProject(_id);

            await viewModel.LoadPostProjectID(_id);

            await viewModel.GetListProjectDiary(_id);

            if (viewModel.DuAn.ImageUtilities != null)
            {
                string[]      utilitiesArr = viewModel.DuAn.ImageUtilities.Split(',');
                Option[]      utilitiesImg = new Option[utilitiesArr.Length];
                List <Option> tienichduan  = BDSUtilities.GetListUtilities();
                for (int i = 0; i < utilitiesArr.Length; i++)
                {
                    var    item  = utilitiesArr[i];
                    Option model = tienichduan.Where(x => x.Id == short.Parse(item)).SingleOrDefault();
                    utilitiesImg[i] = model;
                }
                flowListView.FlowItemsSource = utilitiesImg;
                stTienIchDuAn.IsVisible      = true;
            }
            if (viewModel.DuAn.ImageList != null)
            {
                string[] ListImages = viewModel.DuAn.ImageList;
                for (int i = 0; i < ListImages.Length; i++)
                {
                    Photo photo = new Photo();
                    photo.URL = Api_Link + ListImages[i];
                    GetPhotos.Add(photo);
                }
                lbNumImages.Text        = ListImages.Count().ToString();
                carouseView.ItemsSource = GetPhotos;
            }

            if (viewModel.DuAn.CategoriBDS != null)
            {
                string[] categoriArr     = viewModel.DuAn.CategoriBDS.Split(',');
                string[] categoryNameArr = new string[categoriArr.Length];

                //projectType tren app la categoriBDS tren database
                List <ProjectTypeModel> loaiDuAn = ProjectTypeData.GetListProjectType();
                for (int i = 0; i < categoriArr.Length; i++)
                {
                    var item = categoriArr[i];
                    ProjectTypeModel model = loaiDuAn.Where(x => x.Id == short.Parse(item)).SingleOrDefault();
                    categoryNameArr[i] = model.Name;
                }
                lbCategoriBDS.Text = string.Join(". ", categoryNameArr);

                //lay "Status"
                if (viewModel.DuAn.Status.HasValue)
                {
                    int idStatus = viewModel.DuAn.Status.Value;
                    List <ProjectStatusModel> listStatus  = ProjectStatusData.GetList();
                    ProjectStatusModel        modelStatus = listStatus.Single(x => x.Id == idStatus);
                    lbStatus.Text = modelStatus.Name;
                    if (viewModel.DuAn.Status.Value == 0)
                    {
                        stThoiGianMoBan.IsVisible   = true;
                        stThoiGianBanGiao.IsVisible = true;
                    }

                    if (viewModel.DuAn.Status.Value == 1)
                    {
                        stThoiGianBanGiao.IsVisible = true;
                    }
                }
            }

            await ChekcIsFollowPost();

            loadingPopup.IsVisible = false;

            stNamKhoiCong.IsVisible  = true;
            stNamHoanThanh.IsVisible = true;

            // load data "Tong quan du an"
            lbDienTichCayXanh.Text      = viewModel.DuAn.DienTichCayXanh;
            lbDienTichKhuDat.Text       = viewModel.DuAn.DienTichKhuDat;
            lbDienTichSanTrungBinh.Text = viewModel.DuAn.DienTichSanTrungBinh;
            lbDienTichXayDung.Text      = viewModel.DuAn.DienTichXayDung;
            lbNamKhoiCong.Text          = viewModel.DuAn.NamKhoiCong.ToString();
            lbNamHoanThanh.Text         = viewModel.DuAn.NamHoanThanh.ToString();
            lbMatDoXayDung.Text         = viewModel.DuAn.MatDoXayDungPercent.ToString();
            lbSoLuongSanPham.Text       = viewModel.DuAn.SoLuongSanPham;
            lbSoTang.Text               = viewModel.DuAn.SoTang.ToString();
            lbSoLuongToaNha.Text        = viewModel.DuAn.SoLuongToaNha.ToString();
            lbSoThangMay.Text           = viewModel.DuAn.SoThangMay.ToString();
            lbTongDienTichSan.Text      = viewModel.DuAn.TongDienTichSan;
            lbTongSoVongDauTu.Text      = viewModel.DuAn.TongVonDauTu;
            lbTangHam.Text              = viewModel.DuAn.TangHam.ToString();
            lbThoiGianMoBan.Text        = viewModel.DuAn.ThoiGianMoBan.ToString();
            lbThoiGianBanGiao.Text      = viewModel.DuAn.ThoiGianBanGiao.ToString();
            lblChuDauTu.Text            = viewModel.DuAn.ChuDauTu;
            lblDonViThietKeThiCong.Text = viewModel.DuAn.DonViThietKeThiCong;
            lblPhanKhuDuAn.Text         = viewModel.DuAn.PhanKhuDuAn;

            var gridChildren = grContent.Children.Where(x => x.IsVisible == true).ToList();

            for (int i = 0; i < gridChildren.Count(); i++)
            {
                grContent.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(9, GridUnitType.Auto)
                });
                Grid.SetRow(gridChildren[i], i);
            }
        }
 public static ProjectType ToEntity(this ProjectTypeModel model, ProjectType destination)
 {
     return(TypeAdapter.Adapt(model, destination));
 }
 public static ProjectType ToEntity(this ProjectTypeModel model)
 {
     return(TypeAdapter.Adapt <ProjectTypeModel, ProjectType>(model));
 }
Exemple #13
0
        public async void Init()
        {
            bool HasResult = await viewModel.LoadPost(_id);

            if (!HasResult)
            {
                await DisplayAlert("", Language.bai_dang_khong_ton_tai_hoac_da_xoa, Language.dong);

                await Navigation.PopAsync();

                return;
            }
            // cau hinh button.
            SetFloatingButtonGroup();


            // can thue can mua thi load comment ve. hien thi o comment.
            if (viewModel.GetPost.PostType == 2 || viewModel.GetPost.PostType == 3)
            {
                await viewModel.LoadPostComment();

                StacklayoutPostComments.IsVisible = true;
                onClick_HideShow_Description(null, EventArgs.Empty); // dong lai mo ta. neu post type 2 3
                MessagingCenter.Subscribe <PickPostPage>(this, "OnNewPostComment", async(sender) =>
                {
                    loadingPopup.IsVisible = true;
                    viewModel.PostComments.Clear();
                    viewModel.PostCommentPage = 1;
                    await viewModel.LoadPostComment();
                    loadingPopup.IsVisible = false;
                });
            }
            else
            {
                StacklayoutPostComments.IsVisible = false;
            }

            lbLoaiBatDongSan.Text = LoaiBatDongSanModel.GetList(null).SingleOrDefault(x => x.Id == viewModel.GetPost.LoaiBatDongSanId).Name;

            if (viewModel.GetPost.PostType == 0 || viewModel.GetPost.PostType == 1)
            {
                stListImg.IsVisible = true;
            }


            if (viewModel.GetPost.PostType == 2 || viewModel.GetPost.PostType == 3)
            {
                gridContent.Margin            = new Thickness(0, 10, 0, 0); // đây frame xuong
                cvBDSCungKhuVuc.HeightRequest = 90;
                frContentPost.Margin          = new Thickness(10, 0, 10, 0);
            }

            //lấy danh sách Images
            if (viewModel.GetPost.ImageList != null)
            {
                string[] ListImages = viewModel.GetPost.ImageList;
                for (int i = 0; i < ListImages.Length; i++)
                {
                    Photo photo = new Photo();
                    photo.URL = ImageHelper.GetImageUrl("post", ListImages[i]);
                    GetPhotos.Add(photo);
                }
                lbNumImages.Text        = ListImages.Count().ToString();
                carouseView.ItemsSource = GetPhotos;
            }

            if (viewModel.GetPost.TinhTrangPhapLyId.HasValue)
            {
                var TinhTrangPhapLy = viewModel.GetPost.TinhTrangPhapLyId;
                List <TinhTrangPhapLyModel> tinhtrangphaplyModel = TinhTrangPhapLyData.GetList();
                TinhTrangPhapLyModel        modelTinhTrangPhapLy = tinhtrangphaplyModel.Where(x => x.Id == TinhTrangPhapLy).SingleOrDefault();
                lbTinhTrangPhapLy.Text = modelTinhTrangPhapLy.Name;
            }

            if (viewModel.GetPost.HuongId.HasValue)
            {
                var HuongNha = viewModel.GetPost.HuongId;
                List <HuongModel> huongnhaModel = HuongData.GetList();
                HuongModel        modelHuong    = huongnhaModel.Where(x => x.Id == HuongNha).SingleOrDefault();
                lbHuongNha.Text = modelHuong.Name;
            }

            //set trang thai duu an.
            if (viewModel.GetPost.Project?.Status != null)
            {
                int id_Status = viewModel.GetPost.Project.Status.Value;
                List <ProjectStatusModel> listStatus  = ProjectStatusData.GetList();
                ProjectStatusModel        modelStatus = listStatus.Single(x => x.Id == id_Status);
                spStatus.Text = modelStatus.Name;
            }


            //kiểm tra là lấy thông tin của "nội thất tiện nghi"
            if (viewModel.GetPost.Utilities != null)
            {
                string[]      utilitiesArr = viewModel.GetPost.Utilities.Split(',');
                Option[]      utilitiesImg = new Option[utilitiesArr.Length];
                List <Option> tienichduan  = BDSUtilities.GetListUtilities();
                for (int i = 0; i < utilitiesArr.Length; i++)
                {
                    var    item  = utilitiesArr[i];
                    Option model = tienichduan.Where(x => x.Id == short.Parse(item)).SingleOrDefault();
                    utilitiesImg[i] = model;
                }
                flvUtilities.FlowItemsSource = utilitiesImg;
                stNoiThatTienNghi.IsVisible  = true;
            }
            else
            {
                stNoiThatTienNghi.IsVisible = false;
            }

            //kiểm tra. nếu có projectId thì cho hiện "Thuộc dự an" và lấy loại bất động sản
            if (viewModel.GetPost.ProjectId.HasValue)
            {
                //
                stThuocDuAn.IsVisible = true;
                Guid _idProject = viewModel.GetPost.ProjectId.Value;
                await viewModel.LoadBDSKhac(_id, _idProject);

                if (viewModel.BDSKhac.Count != 0)
                {
                    stBDSKhac.IsVisible = true;
                }

                // lấy loại bất động sản
                string[] categoriArr    = viewModel.GetPost.Project.CategoriBDS.Split(',');
                string[] newCategoriArr = new string[categoriArr.Length];

                List <ProjectTypeModel> modelCategori = ProjectTypeData.GetListProjectType();
                for (int i = 0; i < categoriArr.Length; i++)
                {
                    var temp = categoriArr[i];
                    ProjectTypeModel categoriModel = modelCategori.Where(x => x.Id == short.Parse(temp)).SingleOrDefault();
                    newCategoriArr[i] = categoriModel.Name;
                }

                lbCatogoriBDS.Text = string.Join(", ", newCategoriArr);
            }

            //gán dữ liệ cho label
            lbTongDienTichSuDung.Text = viewModel.GetPost.AreaFormatText;
            lbDuongVao.Text           = viewModel.GetPost.DuongVao.ToString();
            lbMatTien.Text            = viewModel.GetPost.MatTien.ToString();
            lbChieuSau.Text           = viewModel.GetPost.ChieuSau.ToString();
            lbTang.Text       = viewModel.GetPost.Tang.ToString();
            lbSoTang.Text     = viewModel.GetPost.NumOfFloor.ToString();
            lbSoThangMay.Text = viewModel.GetPost.SoThangMay.ToString();
            lbSoDuongNgu.Text = viewModel.GetPost.NumOfBedroom.ToString();
            lbSoPhongtam.Text = viewModel.GetPost.NumOfBathroom.ToString();

            // hiển thị thông tin trong phần "tổng quan dự án" (những thông tin luôn hiện)
            stTinhTrangPhapLy.IsVisible    = true;
            stHuongNha.IsVisible           = true;
            stTongDienTichSuDung.IsVisible = true;

            //hiển thị thông tin trong phần "tổng quan dự án" (kiểm tra theo loại bất động sản)
            var LoaiBatDongSan = viewModel.GetPost.LoaiBatDongSanId;

            if (LoaiBatDongSan == 0)
            {
                stTang.IsVisible       = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 1)
            {
                stTang.IsVisible       = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 2)
            {
                stDuongVao.IsVisible   = true;
                stMatTien.IsVisible    = true;
                stSoTang.IsVisible     = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 3)
            {
                stDuongVao.IsVisible   = true;
                stMatTien.IsVisible    = true;
                stSoTang.IsVisible     = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 4)
            {
                stDuongVao.IsVisible   = true;
                stMatTien.IsVisible    = true;
                stSoTang.IsVisible     = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 5)
            {
                stTang.IsVisible = true;
            }

            if (LoaiBatDongSan == 6)
            {
                stTang.IsVisible       = true;
                stSoThangMay.IsVisible = true;
            }

            if (LoaiBatDongSan == 7)
            {
                stDuongVao.IsVisible   = true;
                stMatTien.IsVisible    = true;
                stSoTang.IsVisible     = true;
                stSoPhongTam.IsVisible = true;
                stSoDuongNgu.IsVisible = true;
            }

            if (LoaiBatDongSan == 8)
            {
                stDuongVao.IsVisible = true;
                stMatTien.IsVisible  = true;
                stChieuSau.IsVisible = true;
            }

            if (LoaiBatDongSan == 9)
            {
                stDuongVao.IsVisible = true;
                stMatTien.IsVisible  = true;
                stChieuSau.IsVisible = true;
            }

            if (LoaiBatDongSan == 10)
            {
                stDuongVao.IsVisible = true;
                stMatTien.IsVisible  = true;
                stChieuSau.IsVisible = true;
            }

            var gridChildren = gridContent.Children.Where(x => x.IsVisible == true).ToList();

            for (int i = 0; i < gridChildren.Count(); i++)
            {
                gridContent.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(9, GridUnitType.Auto)
                });

                Grid.SetRow(gridChildren[i], i);
            }

            //check follow
            await ChekcIsFollowPost();

            //disable loading
            loadingPopup.IsVisible          = false;
            ScrollView_Detail_M_B.IsVisible = true;
        }
Exemple #14
0
        public List <ProjectTypeModel> Get(ProjectTypeModel filter)
        {
            ProjectTypeDA da = new ProjectTypeDA();

            return(da.Get(filter));
        }
        public ActionResult AddProjectType()
        {
            var model = new ProjectTypeModel();

            return(View("~/Plugins/TrinhMinh.WebApi/Views/ProjectType/Create.cshtml", model));
        }
        public IHttpActionResult ProjectTypeCUD([FromBody] ProjectTypeModel projectTypeModel)
        {
            ProjectTypeBL projectTypeBL = new ProjectTypeBL();

            return(Ok(projectTypeBL.ProjectTypeCUD(projectTypeModel)));
        }
Exemple #17
0
        public RequestResult <object> SaveProject(ProjectModel parameters)
        {
            TransactionOptions scopeOptions = new TransactionOptions();

            //scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted;
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions))
            {
                try
                {
                    //here we save basic project info
                    var respSaveProjectBasicInfo = InsUpdProjectInfo(parameters);
                    if (respSaveProjectBasicInfo.Status == Status.Success)
                    {
                        SystemVariableServices SystemVariableServ = new SystemVariableServices();
                        Int16 TypeProject = Convert.ToInt16(SystemVariableServ.GetSystemVariableValue("TypeProject"));

                        var dataProjectBasicInfo = (ProjectModel)respSaveProjectBasicInfo.Data;
                        parameters.ProjectId = dataProjectBasicInfo.ProjectId;

                        //we save specific info
                        SpecificInformationServices SpecificInfoServ  = new SpecificInformationServices();
                        SpecificInformationModel    SpecificInfoModel = parameters;
                        SpecificInfoModel.MatchableId = parameters.ProjectId;
                        SpecificInfoModel.Type        = TypeProject;
                        var respSaveProjectSpecificInfo = SpecificInfoServ.InsUpd(SpecificInfoModel);
                        if (respSaveProjectSpecificInfo.Status == Status.Success)
                        {
                            //we validate project category and only save cabin specifications if project category is personnel transportation
                            ProjectTypeServices ProjectTypeServ    = new ProjectTypeServices();
                            ProjectTypeModel    ProjectType        = ProjectTypeServ.GetById(parameters.ProjectTypeId);
                            string CategoryPersonnelTransportation = SystemVariableServ.GetSystemVariableValue("CategoryPersonnelTransportation");
                            if (ProjectType.Category == CategoryPersonnelTransportation)
                            {
                                ////at the end we save cabin specifications
                                //CabinSpecificationServices CabinSpecificationServ = new CabinSpecificationServices();
                                //foreach (var item in parameters.CabinSpecification.ToList())
                                //{
                                //    item.ReferenceId = parameters.ProjectId;
                                //    item.Type = TypeProject;
                                //    var respSaveCabinSpecification = CabinSpecificationServ.InsUpd(item);
                                //    if (respSaveCabinSpecification.Status == Status.Error)
                                //        throw new Exception(respSaveCabinSpecification.Message);
                                //}
                            }

                            ts.Complete();
                            return(new RequestResult <object>()
                            {
                                Status = Status.Success, Data = parameters
                            });
                        }
                        else
                        {
                            throw new Exception(respSaveProjectSpecificInfo.Message);
                        }
                    }
                    else
                    {
                        //return respSaveProjectBasicInfo;
                        throw new Exception(respSaveProjectBasicInfo.Message);
                    }
                }
                catch (Exception ex)
                {
                    ts.Dispose();
                    return(new RequestResult <object>()
                    {
                        Status = Status.Error, Message = ex.Message
                    });
                }
            }
        }
 public string GetProjectType(ProjectTypeModel projectTypeModel)
 {
     projectTypeModel.Sqlprms    = new SqlParameter[1];
     projectTypeModel.Sqlprms[0] = new SqlParameter("@ProjectTypeCD", projectTypeModel.ProjectTypeCD);
     return(cKMDL.SelectJson("ProjectType_Select", ff.GetConnectionWithDefaultPath("PJMS"), projectTypeModel.Sqlprms));
 }