public JsonResult GetVendorUserInformationByVendorUserID(VendorUserRegistrationModel collection)
        {
            try
            {
                VendorUserRegistrationModel _list = new VendorUserRegistrationModel();
                var _objVendorUserRegistration    = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Where(p => p.VendorUserID == collection.VendorUserID).FirstOrDefault();
                var _objContractor = _DbWorkPermitSystemEntities.tbl_ContractorMaster.Where(p => p.ContractorSrNo == _objVendorUserRegistration.VendorContractorSrNo).FirstOrDefault();

                _list.VendorSrNo             = _objVendorUserRegistration.VendorSrNo;
                _list.VendorUserID           = _objVendorUserRegistration.VendorUserID;
                _list.VendorName             = _objVendorUserRegistration.VendorName;
                _list.VendorAddress          = _objVendorUserRegistration.VendorAddress;
                _list.VendorContactNo        = _objVendorUserRegistration.VendorContactNo;
                _list.VendorEmailID          = _objVendorUserRegistration.VendorEmailID;
                _list.VendorNatureOfWork     = _objVendorUserRegistration.VendorNatureOfWork;
                _list.VendorContractorSrNo   = _objContractor.ContractorSrNo;
                _list.VendorContractorName   = _objContractor.ContractorName;
                _list.VendorContractorCoNo   = _objVendorUserRegistration.VendorContractorCoNo;
                _list.VendorPassword         = _objVendorUserRegistration.VendorPassword;
                _list.VendorRegistrationDate = _objVendorUserRegistration.VendorRegistrationDate;

                return(Json(_list, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ResultModel _objResult = new ResultModel();
                _objResult.success = 0;
                _objResult.msg     = ex.ToString();
                return(Json(_objResult, JsonRequestBehavior.AllowGet));
            }
        }
        // GET: VendorRegistration
        public ActionResult Index()
        {
            CheckViewBagData();
            List <VendorUserRegistrationModel> _objVendorUserRegistrationModel = new List <VendorUserRegistrationModel>();
            var VendorUserRegistration = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.ToList();

            foreach (var item in VendorUserRegistration)
            {
                var _objContractor = _DbWorkPermitSystemEntities.tbl_ContractorMaster.Where(p => p.ContractorSrNo == item.VendorContractorSrNo).FirstOrDefault();

                VendorUserRegistrationModel _objVendorUserRegistrationModelItem = new VendorUserRegistrationModel();
                _objVendorUserRegistrationModelItem.VendorSrNo             = item.VendorSrNo;
                _objVendorUserRegistrationModelItem.VendorUserID           = item.VendorUserID;
                _objVendorUserRegistrationModelItem.VendorName             = item.VendorName;
                _objVendorUserRegistrationModelItem.VendorAddress          = item.VendorAddress;
                _objVendorUserRegistrationModelItem.VendorContactNo        = item.VendorContactNo;
                _objVendorUserRegistrationModelItem.VendorEmailID          = item.VendorEmailID;
                _objVendorUserRegistrationModelItem.VendorNatureOfWork     = item.VendorNatureOfWork;
                _objVendorUserRegistrationModelItem.VendorContractorName   = _objContractor.ContractorName;
                _objVendorUserRegistrationModelItem.VendorContractorCoNo   = item.VendorContractorCoNo;
                _objVendorUserRegistrationModelItem.VendorPassword         = item.VendorPassword;
                _objVendorUserRegistrationModelItem.VendorRegistrationDate = item.VendorRegistrationDate;
                _objVendorUserRegistrationModel.Add(_objVendorUserRegistrationModelItem);
            }
            return(View(_objVendorUserRegistrationModel.ToList()));
        }
        public JsonResult AddVendorUserRegistration(VendorUserRegistrationModel collection)
        {
            try
            {
                var data = new tbl_VendorUserRegistration
                {
                    DeviceTokenId          = collection.DeviceTokenId,
                    VendorUserID           = collection.VendorUserID,
                    VendorName             = collection.VendorName,
                    VendorAddress          = collection.VendorAddress,
                    VendorContactNo        = collection.VendorContactNo,
                    VendorEmailID          = collection.VendorEmailID,
                    VendorNatureOfWork     = collection.VendorNatureOfWork,
                    VendorContractorSrNo   = collection.VendorContractorSrNo,
                    VendorContractorCoNo   = collection.VendorContractorCoNo,
                    VendorPassword         = collection.VendorPassword,
                    VendorRegistrationDate = DateTime.Now
                };

                _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Add(data);
                _DbWorkPermitSystemEntities.SaveChanges();
                ResultModel _objResult = new ResultModel();
                _objResult.success = 1;
                _objResult.msg     = "Save Successfully";
                return(Json(_objResult, JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                ResultModel _objResult = new ResultModel();
                _objResult.success = 0;
                _objResult.msg     = ex.ToString();
                return(Json(_objResult, JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult Edit(int id, VendorUserRegistrationModel collection)
 {
     try
     {
         // TODO: Add update logic here
         CheckViewBagData();
         if (ModelState.IsValid)
         {
             var data           = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Where(b => b.VendorSrNo == id).FirstOrDefault();
             var _objContractor = _DbWorkPermitSystemEntities.tbl_ContractorMaster.Where(p => p.ContractorSrNo == collection.VendorContractorSrNo).FirstOrDefault();
             //data.EmployeeSrNo = collection.EmployeeSrNo;
             data.VendorUserID         = collection.VendorUserID;
             data.VendorName           = collection.VendorName;
             data.VendorAddress        = collection.VendorAddress;
             data.VendorContactNo      = collection.VendorContactNo;
             data.VendorEmailID        = collection.VendorEmailID;
             data.VendorNatureOfWork   = collection.VendorNatureOfWork;
             data.VendorContractorSrNo = _objContractor.ContractorSrNo;
             data.VendorContractorCoNo = collection.VendorContractorCoNo;
             data.VendorPassword       = collection.VendorPassword;
             // data.viitorcon
             _DbWorkPermitSystemEntities.Entry(data).State = EntityState.Modified;
             _DbWorkPermitSystemEntities.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.ContractorNameCombo = new SelectList(_DbWorkPermitSystemEntities.tbl_ContractorMaster, "ContractorSrNo", "ContractorName", collection.VendorContractorSrNo);
         return(View());
     }
     catch (Exception e)
     {
         return(View());
     }
 }
        // GET: VendorRegistration/Edit/5
        public ActionResult Edit(int id)
        {
            CheckViewBagData();

            VendorUserRegistrationModel _objVendorUserRegistrationModel = new VendorUserRegistrationModel();
            var data = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Where(p => p.VendorSrNo == id).FirstOrDefault();

            {
                var _objContractor = _DbWorkPermitSystemEntities.tbl_ContractorMaster.Where(p => p.ContractorSrNo == data.VendorContractorSrNo).FirstOrDefault();
                _objVendorUserRegistrationModel.VendorSrNo           = data.VendorSrNo;
                _objVendorUserRegistrationModel.VendorUserID         = data.VendorUserID;
                _objVendorUserRegistrationModel.VendorName           = data.VendorName;
                _objVendorUserRegistrationModel.VendorContactNo      = data.VendorContactNo;
                _objVendorUserRegistrationModel.VendorAddress        = data.VendorAddress;
                _objVendorUserRegistrationModel.VendorContractorName = _objContractor.ContractorName;
                _objVendorUserRegistrationModel.VendorContractorCoNo = data.VendorContractorCoNo;
                _objVendorUserRegistrationModel.VendorEmailID        = data.VendorEmailID;
                _objVendorUserRegistrationModel.VendorNatureOfWork   = data.VendorNatureOfWork;
                _objVendorUserRegistrationModel.VendorPassword       = data.VendorPassword;
                _objVendorUserRegistrationModel.VendorContractorSrNo = data.VendorContractorSrNo;
                //_objVendorUserRegistrationModel.VendorRegistrationDate = data.VendorRegistrationDate;
            };
            ViewBag.ContractorNameCombo = new SelectList(_DbWorkPermitSystemEntities.tbl_ContractorMaster, "ContractorSrNo", "ContractorName", _objVendorUserRegistrationModel.VendorContractorSrNo);
            return(View(_objVendorUserRegistrationModel));
        }
        // GET: VendorRegistration/Create
        public ActionResult Create()
        {
            CheckViewBagData();
            VendorUserRegistrationModel VendorUserMaxSrNo = new VendorUserRegistrationModel();
            var _objVendorUserRegistration = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.DefaultIfEmpty().Max(p => p == null?0: p.VendorSrNo);

            ViewBag.VendorSrNo          = _objVendorUserRegistration + 1;
            ViewBag.UserID              = "M&M" + ViewBag.VendorSrNo;
            ViewBag.ContractorNameCombo = new SelectList(_DbWorkPermitSystemEntities.tbl_ContractorMaster, "ContractorSrNo", "ContractorName");
            return(View());
        }
        // [END refresh_token]

        /**
         * Persist token to third-party servers.
         *
         * Modify this method to associate the user's FCM InstanceID token with any server-side account
         * maintained by your application.
         */
        async void SendRegistrationToServerForVendor(string token, string UserID)
        {
            VendorUserRegistrationModel _objVendorUserRegistrationModel = new VendorUserRegistrationModel();

            _objVendorUserRegistrationModel.DeviceTokenId = token.Trim();
            _objVendorUserRegistrationModel.VendorUserID  = UserID.Trim();

            string     Url        = StatusModel.Url + "UpdateVendorDeviceTokenNumber";
            WebHelpper _objHelper = new WebHelpper();

            var PostString = JsonConvert.SerializeObject(_objVendorUserRegistrationModel);
            var request    = await _objHelper.MakePostRequest(Url, PostString, true);

            ResultModel ResultgetRequest = JsonConvert.DeserializeObject <ResultModel>(request);
        }
 //Vendor UserID
 public JsonResult GetVendorUserMaxSrNo()
 {
     try
     {
         VendorUserRegistrationModel VendorUserMaxSrNo = new VendorUserRegistrationModel();
         var _objVendorUserRegistration = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Max(p => p.VendorSrNo);
         VendorUserMaxSrNo.VendorSrNo = _objVendorUserRegistration + 1;
         return(Json(VendorUserMaxSrNo, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         ResultModel _objResult = new ResultModel();
         _objResult.success = 0;
         _objResult.msg     = ex.ToString();
         return(Json(_objResult, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult Create(VendorUserRegistrationModel collection)
        {
            try
            {
                CheckViewBagData();
                var _objVendorUserRegistration = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.DefaultIfEmpty().Max(p => p == null ? 0 : p.VendorSrNo);
                ViewBag.VendorSrNo = _objVendorUserRegistration + 1;
                ViewBag.UserID     = "M&M" + ViewBag.VendorSrNo;

                if (ModelState.IsValid)
                {
                    var data = new tbl_VendorUserRegistration
                    {
                        VendorUserID           = collection.VendorUserID,
                        VendorName             = collection.VendorName,
                        VendorAddress          = collection.VendorAddress,
                        VendorContactNo        = collection.VendorContactNo,
                        VendorEmailID          = collection.VendorEmailID,
                        VendorNatureOfWork     = collection.VendorNatureOfWork,
                        VendorContractorSrNo   = collection.VendorContractorSrNo,
                        VendorContractorCoNo   = collection.VendorContractorCoNo,
                        VendorPassword         = collection.VendorPassword,
                        VendorRegistrationDate = DateTime.Now
                    };


                    _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Add(data);
                    _DbWorkPermitSystemEntities.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                ViewBag.ContractorNameCombo = new SelectList(_DbWorkPermitSystemEntities.tbl_ContractorMaster, "ContractorSrNo", "ContractorName");
                return(View());
            }
            catch (Exception ex)
            {
                ResultModel _objResult = new ResultModel();
                _objResult.success = 0;
                _objResult.msg     = ex.ToString();
                return(View());
            }
        }
Esempio n. 10
0
        public async void GetAllEmployeeDepartmentInfoByTokenNo()
        {
            try
            {
                progressDialog = ProgressDialog.Show(this, Android.Text.Html.FromHtml("<font color='#EC407A'> Please wait...</font>"), Android.Text.Html.FromHtml("<font color='#EC407A'> Checking User Info...</font>"), true);

                string     Url        = StatusModel.Url + "GetVendorUserInformationByVendorUserID";
                WebHelpper _objHelper = new WebHelpper();
                VendorUserRegistrationModel _objVendorUserRegistrationModel = new VendorUserRegistrationModel();

                _objVendorUserRegistrationModel.VendorUserID = StatusModel.LoginUserName;

                var PostString = JsonConvert.SerializeObject(_objVendorUserRegistrationModel);
                var request    = await _objHelper.MakePostRequest(Url, PostString, true);

                VendorUserRegistrationModel ResultVendorUserRegistrationModel = JsonConvert.DeserializeObject <VendorUserRegistrationModel>(request);



                string     Url1        = StatusModel.Url + "GetProcessRequestByVendorUserSrNo";
                WebHelpper _objHelper1 = new WebHelpper();

                var PostString1 = JsonConvert.SerializeObject(ResultVendorUserRegistrationModel);
                var request1    = await _objHelper1.MakePostRequest(Url1, PostString1, true);

                ResultListProcessRequestByVendorUserModel = JsonConvert.DeserializeObject <List <ListProcessRequestByVendorUserModel> >(request1);


                mListView.Adapter = new RPItemListForVendorAdapter(this, ResultListProcessRequestByVendorUserModel);

                progressDialog.Hide();
            }
            catch (Exception e)
            {
                progressDialog.Hide();

                string ErrorMsg = e.ToString();
                Toast.MakeText(this, ErrorMsg, ToastLength.Long).Show();
            }
        }
        public JsonResult UpdateVendorDeviceTokenNumber(VendorUserRegistrationModel collection)
        {
            try
            {
                var _objAllRequestProcessModel = _DbWorkPermitSystemEntities.tbl_VendorUserRegistration.Where(a => a.VendorUserID == collection.VendorUserID).FirstOrDefault();

                _objAllRequestProcessModel.DeviceTokenId = collection.DeviceTokenId;
                _DbWorkPermitSystemEntities.Entry(_objAllRequestProcessModel).State = EntityState.Modified;
                _DbWorkPermitSystemEntities.SaveChanges();
                ResultModel _objResult = new ResultModel();
                _objResult.success = 1;
                _objResult.msg     = "Save Successfully";

                return(Json(_objResult, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ResultModel _objResult = new ResultModel();
                _objResult.success = 0;
                _objResult.msg     = ex.ToString();
                return(Json(_objResult, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 12
0
        private async void RequestProcess()
        {
            try
            {
                Drawable icon_error = Resources.GetDrawable(Resource.Drawable.alert);
                icon_error.SetBounds(0, 0, 40, 30);

                if (txt_EmployeeName.Text != "")
                {
                    if (txt_EmployeeDepartmentID.Text != "")
                    {
                        if (dtp_RequestStartTime.Text != "")
                        {
                            if (dtp_RequestEndTime.Text != "")
                            {
                                if (txt_Associries.Text != "")
                                {
                                    if (txt_NoOFVendors.Text != "")
                                    {
                                        if (txt_Reasons.Text != "")
                                        {
                                            foreach (var item in ResultGetAllDepartmentEmployeeNameModel)
                                            {
                                                if (item.EmployeeName.ToString().Trim() == (txt_EmployeeName.Text.Trim()))
                                                {
                                                    _ObjRequestProcess.EmployeeDepartmentID = item.EmployeeDepartmentID;
                                                    _ObjRequestProcess.EmployeeId           = item.EmployeeSrNo;
                                                }
                                            }

                                            progressDialog = ProgressDialog.Show(this, Android.Text.Html.FromHtml("<font color='#EC407A'> Please wait...</font>"), Android.Text.Html.FromHtml("<font color='#EC407A'> Creating New Request...</font>"), true);


                                            string     Url        = StatusModel.Url + "GetVendorUserInformationByVendorUserID";
                                            WebHelpper _objHelper = new WebHelpper();
                                            VendorUserRegistrationModel _objVendorUserRegistrationModel = new VendorUserRegistrationModel();

                                            _objVendorUserRegistrationModel.VendorUserID = StatusModel.LoginUserName;

                                            var PostString = JsonConvert.SerializeObject(_objVendorUserRegistrationModel);
                                            var request    = await _objHelper.MakePostRequest(Url, PostString, true);

                                            VendorUserRegistrationModel ResultVendorUserRegistrationModel = JsonConvert.DeserializeObject <VendorUserRegistrationModel>(request);



                                            _ObjRequestProcess.VendorSrNo          = ResultVendorUserRegistrationModel.VendorSrNo;
                                            _ObjRequestProcess.VisitStartTime      = Convert.ToDateTime(dtp_RequestStartTime.Text);
                                            _ObjRequestProcess.VisitEndTime        = Convert.ToDateTime(dtp_RequestEndTime.Text);
                                            _ObjRequestProcess.VendorAccessories   = txt_Associries.Text;
                                            _ObjRequestProcess.NoOfVendors         = Convert.ToInt32(txt_NoOFVendors.Text);
                                            _ObjRequestProcess.VendorVisitResons   = txt_Reasons.Text;
                                            _ObjRequestProcess.RequestProcessDate  = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                            _ObjRequestProcess.ActivityOwnerStatus = "None";
                                            _ObjRequestProcess.AreaOwnerStatus     = "None";
                                            _ObjRequestProcess.SafetyStatus        = "None";
                                            _ObjRequestProcess.ContractorStatus    = "None";
                                            // ADD Insert Code Here

                                            WebHelpper _objHelper1 = new WebHelpper();

                                            string Url1 = StatusModel.Url + "AddRequestProcess";

                                            var PostString1  = JsonConvert.SerializeObject(_ObjRequestProcess);
                                            var requestTemp1 = await _objHelper1.MakePostRequest(Url1, PostString1, true);

                                            ResultModel ResultgetRequest1 = JsonConvert.DeserializeObject <ResultModel>(requestTemp1);

                                            if (ResultgetRequest1.success == 1)
                                            {
                                                progressDialog.Hide();
                                                Toast.MakeText(this, ResultgetRequest1.msg, ToastLength.Short).Show();
                                            }

                                            else
                                            {
                                                progressDialog.Hide();
                                                Toast.MakeText(this, ResultgetRequest1.msg, ToastLength.Short).Show();
                                                return;
                                            }

                                            clear();
                                        }
                                        else
                                        {
                                            txt_Reasons.RequestFocus();
                                            txt_Reasons.SetError("Please Enter Visit Reason First", icon_error);
                                        }
                                    }
                                    else
                                    {
                                        txt_NoOFVendors.RequestFocus();
                                        txt_NoOFVendors.SetError("Please Select No of Vendors First", icon_error);
                                    }
                                }
                                else
                                {
                                    txt_Associries.RequestFocus();
                                    txt_Associries.SetError("Please Enter Associries First", icon_error);
                                }
                            }

                            else
                            {
                                dtp_RequestEndTime.RequestFocus();
                                dtp_RequestEndTime.SetError("Please Select End Time First", icon_error);
                            }
                        }
                        else
                        {
                            dtp_RequestEndTime.RequestFocus();
                            dtp_RequestEndTime.SetError("Please Select Start Time First", icon_error);
                        }
                    }
                    else
                    {
                        txt_EmployeeDepartmentID.RequestFocus();
                        txt_EmployeeDepartmentID.SetError("Please Select Employee Department First", icon_error);
                    }
                }
                else
                {
                    txt_EmployeeName.RequestFocus();
                    txt_EmployeeName.SetError("Please Enter Full Name First", icon_error);
                }
            }
            catch (Exception e)
            {
                string ErrorMsg = e.ToString();
                Toast.MakeText(this, ErrorMsg, ToastLength.Long).Show();
            }
        }