Example #1
0
        // GET: Information/Edit/5
        public ActionResult Edit(long id)
        {
            InformationDao dbDao = new InformationDao();

            SetViewBag();
            FeedbackInforDao feedDao = new FeedbackInforDao();

            ViewBag.Feedback   = feedDao.ToListFeebBackUser(id).ToArray <FeedbacInfokUser>();
            ViewBag.Infomation = dbDao.FindByID(id);
            SetViewSupplier(ViewBag.Infomation.SupplierID);
            SetStatus(ViewBag.Infomation.Status);
            InforUserDao     usDao      = new InforUserDao();
            List <InforUser> lstUP      = usDao.FindByInforID(ViewBag.Infomation.InformationID);
            List <string>    lstUPlogin = new List <string>();

            foreach (var pUs in lstUP)
            {
                //string sLogin = pUs.LoginID.ToString();
                lstUPlogin.Add(pUs.LoginID.ToString());
            }
            SetUserBag(lstUPlogin.ToArray <string>());

            if (ViewBag.Infomation.ContratorID != null)
            {
                ContratorDao contrDao  = new ContratorDao();
                Contrator    objConTra = contrDao.FindByID(ViewBag.Infomation.ContratorID);
                string       str       = "<p><b>Tên chủ đầu tư: </b>" + objConTra.ContraName + "</p>";
                str += "<p><b>Địa chỉ: </b>" + objConTra.Address + "</p>";
                str += "<p><b>Thông tin liên hệ: </b>" + objConTra.FullName + "<b> &nbsp;&nbsp;&nbsp;  Điện thoại: </b>" + objConTra.Phone + "</p>";
                ViewBag.PrContraDetail = str;
                ViewBag.PrContraCode   = objConTra.ContratorID;
            }
            if (ViewBag.Infomation.BuilderID != null)
            {
                BuilderDao buiDao     = new BuilderDao();
                Builder    objBuilder = buiDao.FindByID(ViewBag.Infomation.BuilderID);
                ViewBag.PrBuiderCode = objBuilder.BuilderID;
                string str = "";
                str  = "<p><b>Tên nhà thầu: </b>" + objBuilder.BuilderName + "</p>";
                str += "<p><b>Địa chỉ: </b>" + objBuilder.Address + "</p>";
                str += "<p><b>Thông tin liên hệ: </b>" + objBuilder.FullName + "<b>&nbsp;&nbsp; &nbsp; Điện thoại: </b>" + objBuilder.Phone + "</p>";
                ViewBag.BuiderDetail = str;
            }



            return(View());
        }
Example #2
0
        // GET: FeedbackInfor
        public ActionResult Index(long id)
        {
            InformationDao bdDao = new InformationDao();

            ViewBag.Project = bdDao.FindByID(id);
            FeedbackInforDao feedDao = new FeedbackInforDao();

            ViewBag.Feedback = feedDao.ToListFeebBackUser(id).ToArray <FeedbacInfokUser>();
            List <FeedbacInfokUser> fdnul = new List <FeedbacInfokUser>();

            foreach (FeedbacInfokUser fb in ViewBag.Feedback)
            {
                if (fb.ChildID == null)
                {
                    fdnul.Add(fb);
                }
            }
            ViewBag.FeedbackNull = fdnul.ToArray <FeedbacInfokUser>();
            return(View());
        }
Example #3
0
        public JsonResult CreateFeedBack(long inforID, string content, long?chilID = null)
        {
            UserLogin     us          = (UserLogin)Session[CommonConstant.USER_SESSION];
            FeedbackInfor objFeedback = new FeedbackInfor();
            var           dao         = new FeedbackInforDao();

            objFeedback.InformationID = inforID;
            objFeedback.Description   = content;
            objFeedback.ChildID       = chilID;
            objFeedback.CreateDate    = Hepper.GetDateServer();
            objFeedback.ModifiedDate  = Hepper.GetDateServer();
            objFeedback.CreateBy      = us.UserName;
            objFeedback.ModifiedBy    = us.UserName;
            var        data   = dao.Insert(objFeedback);
            JsonResult result = new JsonResult();

            result.Data = data;
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(result);
        }
Example #4
0
        public ActionResult Index(FormCollection data)
        {
            try
            {
                UserLogin us        = (UserLogin)Session[CommonConstant.USER_SESSION];
                var       dao       = new FeedbackInforDao();
                long      projectID = Convert.ToInt64(data["txtID"].ToString());

                FeedbackInfor objFeedback = new FeedbackInfor();

                objFeedback.InformationID = projectID;
                objFeedback.Description   = data["txtDescription"].ToString();
                objFeedback.CreateDate    = Hepper.GetDateServer();
                objFeedback.ModifiedDate  = Hepper.GetDateServer();
                objFeedback.CreateBy      = us.UserName;
                objFeedback.ModifiedBy    = us.UserName;
                if (dao.Insert(objFeedback) > 0)
                {
                    SetAlert("Thêm thành công", "success");
                    ViewBag.Feedback = dao.ToListFeebBackUser(projectID).ToArray <FeedbacInfokUser>();
                    List <FeedbacInfokUser> fdnul = new List <FeedbacInfokUser>();
                    foreach (FeedbacInfokUser fb in ViewBag.Feedback)
                    {
                        if (fb.ChildID == null)
                        {
                            fdnul.Add(fb);
                        }
                    }
                    ViewBag.FeedbackNull = fdnul.ToArray <FeedbacInfokUser>();
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                SetAlert("Không thêm được", "danger");
                return(View());
            }
            return(View());
        }
Example #5
0
        public ActionResult Edit(FormCollection data)
        {
            try
            {
                InformationDao   dbDao      = new InformationDao();
                long             id         = Convert.ToInt64(data["hdIDInfor"].ToString());
                Information      objProject = dbDao.FindByID(id);
                FeedbackInforDao feedDao    = new FeedbackInforDao();
                ViewBag.Feedback = feedDao.ToListFeebBackUser(id).ToArray <FeedbacInfokUser>();
                // string cityID = data["CityID"].ToString();
                // SetViewBag(cityID);
                // long categoryID = Convert.ToInt64(data["CategoryID"].ToString());
                //long priceID = Convert.ToInt64(data["PriceID"].ToString());
                if (ModelState.IsValid)
                {
                    string   name        = data["Name"].ToString();
                    string   address     = data["Address"].ToString();
                    string   contratorID = data["txtContratorID"].ToString();
                    string   builderID   = data["txtBuilder"].ToString();
                    string   Note        = data["txtNote"].ToString();
                    string[] members     = data.GetValues("drbMember");

                    SetUserBag(members);

                    bool kt = true;
                    //Kiem tra ma chu dau tu
                    if (contratorID.Trim().Length > 0)
                    {
                        ContratorDao contraDAO = new ContratorDao();
                        Contrator    objContra = contraDAO.FindByCode(contratorID.Trim());
                        if (objContra == null)
                        {
                            kt = false;
                            ModelState.AddModelError("", "Mã chủ đầu tư không đúng!");
                        }
                    }


                    //Kiem tra nha thau thi cong
                    if (builderID.Trim().Length > 0)
                    {
                        BuilderDao buiderDao = new BuilderDao();
                        Builder    objBuider = buiderDao.FindByCode(builderID.Trim());
                        if (objBuider == null)
                        {
                            kt = false;
                            ModelState.AddModelError("", "Mã nhà thầu thi công không đúng!");
                        }
                    }

                    if (kt == true)
                    {
                        objProject.Address = address;

                        if (contratorID.Trim().Length > 0)
                        {
                            objProject.ContratorID = (new ContratorDao().FindByCode(contratorID.Trim()).ID);
                        }
                        if (builderID.Trim().Length > 0)
                        {
                            objProject.BuilderID = (new BuilderDao().FindByCode(builderID.Trim()).ID);
                        }

                        //  objProject.SupplierID = Convert.ToInt64(data["drlSupplier"]);
                        UserLogin us = (UserLogin)Session[CommonConstant.USER_SESSION];

                        if (data["drlStatus"] != null)
                        {
                            int iStatus = Convert.ToInt32(data["drlStatus"].ToString());
                            // long iSupplierID = Convert.ToInt64(data["drlSupplier"].ToString());
                            objProject.Status = iStatus;
                        }


                        objProject.ModifiedDate = Hepper.GetDateServer();
                        objProject.Description  = data["txtDescription"].ToString();
                        objProject.ModifiedBy   = us.UserName;
                        objProject.Note         = Note;
                        objProject.Name         = name;

                        long infoID = dbDao.Update(objProject);
                        //thêm danh sách nhóm vào trong dự án
                        InforUserDao prUSDao = new InforUserDao();
                        if (members != null)
                        {
                            //Xóa nhóm thuộc dự án
                            prUSDao.Delete(objProject.InformationID);
                            // InforUser objPrUS = new InforUser();
                            //objPrUS.InforID = infoID;
                            //objPrUS.LoginID = us.UserID;
                            //objPrUS.IsAdmin = true;
                            //prUSDao.Insert(objPrUS);
                            foreach (string sUsID in members)
                            {
                                long usID = Convert.ToInt64(sUsID);
                                if (usID != us.UserID)
                                {
                                    InforUser objPrUSM = new InforUser();
                                    objPrUSM.InforID = infoID;
                                    objPrUSM.LoginID = usID;
                                    objPrUSM.IsAdmin = false;
                                    prUSDao.Insert(objPrUSM);
                                }
                            }
                        }

                        SetAlert("Cập nhật thành công", Common.CommonConstant.ALERT_SUCCESS);
                        return(RedirectToAction("Manager", "Information"));
                    }

                    else
                    {
                        SetAlert("Không cập nhật được", Common.CommonConstant.ALERT_WARNING);
                        return(RedirectToAction("Manager", "Information"));
                    }
                }
                else
                {
                    SetAlert("Không cập nhật được", Common.CommonConstant.ALERT_WARNING);
                    return(RedirectToAction("Manager", "Information"));
                }
            }
            catch
            {
                SetAlert("Không cập nhật được", Common.CommonConstant.ALERT_WARNING);

                return(RedirectToAction("Manager", "Information"));
            }
        }