// コンストラクタ

        public ConfigurePincodeViewModel(DialogService dialogService, AddAccountService addAccountModel)
        {
            // DI
            _dialogService     = dialogService;
            _addAccountService = addAccountModel;

            // バリデーションを有効化する
            Pincode.SetValidateAttribute(() => Pincode);

            // Pincodeが入力されているときのみ「次へ」を押せるようにする
            NextCommand = Pincode
                          .ObserveHasErrors
                          .Select(x => !x)
                          .ToReactiveCommand()
                          .AddTo(Disposables);

            // 「次へ」が押されたらPinコードの認証を開始する
            NextCommand.Subscribe(() =>
            {
                _addAccountService.ConfigureAccessTokens(Pincode.Value);
                _dialogService.CloseConfigurePincodeView();
                _dialogService.CloseConfigureApiKeyView();
            })
            .AddTo(Disposables);
        }
Пример #2
0
        public List <APIResponse> InsertPincode(Pincode obj)
        {
            List <APIResponse> responseList = new List <APIResponse>();
            APIResponse        responseObj  = new APIResponse();
            //First input parameter
            var cityID = new SqlParameter
            {
                ParameterName = "@cityID",
                SqlDbType     = SqlDbType.Int,
                Direction     = ParameterDirection.Input,
                Value         = obj.city_id
            };

            //Second input parameter
            var pincode = new SqlParameter
            {
                ParameterName = "@pincode",
                SqlDbType     = SqlDbType.VarChar,
                Direction     = ParameterDirection.Input,
                Value         = obj.pincode,
                Size          = 500
            };
            //third out parameter
            var responseMsg = new SqlParameter
            {
                ParameterName = "@responseMsg",
                SqlDbType     = SqlDbType.VarChar,
                Direction     = ParameterDirection.Output,
                Size          = 500
            };
            var responseCode = new SqlParameter
            {
                ParameterName = "@responseCode",
                SqlDbType     = SqlDbType.VarChar,
                Direction     = ParameterDirection.Output,
                Size          = 500
            };
            string SQLString = "EXEC [dbo].[USP_AddPincode] @pincode, @cityID, @responseMsg OUT, @responseCode OUT";
            var    result    = _dbContext.Database.ExecuteSqlCommand(SQLString, pincode, cityID, responseMsg, responseCode);

            responseObj.responseMsg  = (string)responseMsg.Value;
            responseObj.responseCode = (int)responseCode.Value;
            responseList.Add(responseObj);
            return(responseList);
        }
    protected void btSave_Click(object sender, EventArgs e)
    {
        Pincode pin = new Pincode();

        pin.AreaOfCity = txtarea.Text;
        pin.CityIDF    = int.Parse(ddcity.SelectedValue);
        pin.StateIDF   = int.Parse(ddstate.SelectedValue);
        pin.IsActive   = cbIsActive.Checked;
        MEMBERS.SQLReturnValue mRes;
        mRes = Pincode.Insert_Pincode(pin);
        if (mRes.ValueFromSQL == 1)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
        }
        ClearCaching.ClearControls(PincodePanel);
    }
Пример #4
0
 public void MarkAsModified(Pincode item)
 {
     Entry(item).State = EntityState.Modified;
 }
Пример #5
0
        public void Update()
        {
            string        strsql        = "update Branch set " + "CompanyId= " + CompanyId + ", " + "BranchName= '" + BranchName.Replace("'", "''") + "', " + "AddressLine1= '" + AddressLine1.Replace("'", "''") + "', " + "AddressLine2= '" + AddressLine2.Replace("'", "''") + "', " + "CityId= " + CityId + ", " + "Pincode= '" + Pincode.Replace("'", "''") + "', " + "StateId= " + StateId + ", " + "CountryId= " + CountryId + ", " + "PhoneNumber1= '" + PhoneNumber1.Replace("'", "''") + "', " + "PhoneNumber2= '" + PhoneNumber2.Replace("'", "''") + "', " + "EmailId1= '" + EmailId1.Replace("'", "''") + "', " + "EmailId2= '" + EmailId2.Replace("'", "''") + "' " + " where ID =" + Id;
            SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString);

            ObjConnection.Open();
            SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection);

            ObjCommand.ExecuteNonQuery();
            ObjConnection.Dispose();
            ObjCommand.Dispose();
        }
        public ActionResult Card(PinViewModel Pin)
        {
            for (int counter = 1; counter <= Pin.Quantity; counter++)
            {
                int    length     = Pin.Digit;
                string guidResult = System.Guid.NewGuid().ToString();
                // Remove the hyphens
                guidResult = guidResult.Replace("-", string.Empty);

                // Make sure length is valid
                if (length <= 0 || length > guidResult.Length)
                {
                    throw new ArgumentException("Length must be between 1 and " + guidResult.Length);
                }
                // Return the first length bytes
                ViewBag.Number = guidResult.Substring(1, length).ToUpper();



                //*********************************
                int    limit = 1000000;
                string SerialNo;

                var maxValue = "";

                if (Pin.StartFrom == null)
                {
                    maxValue = db.Pincodes.OrderByDescending(x => x.PincodeId).Where(x => x.SerialNumber.Contains(Pin.SerialCode.ToUpper())).FirstOrDefault().SerialNumber;
                }
                else
                {
                    maxValue = Pin.SerialCode.ToUpper() + "/" + Pin.StartFrom;
                }
                var defaultnumber = Pin.SerialCode.ToUpper() + "/" + "000000";
                if (maxValue == null)
                {
                    maxValue = defaultnumber;
                }
                maxValue = maxValue.Substring(5, 6);
                int    rst       = int.Parse(maxValue);
                int    NewNumber = limit + rst + 1;
                string val       = NewNumber.ToString();
                val      = val.Substring(1, 6);
                SerialNo = Pin.SerialCode.ToUpper() + "/" + val;
                //SerialNo = "SEMB/" + val;
                Pin.StartFrom = null;
                var year = DateTime.Now.Year;
                //**************************



                Pincode cardNumber = db.Pincodes.Create();
                cardNumber.PinNumber    = guidResult.Substring(0, length).ToUpper();
                cardNumber.SerialNumber = SerialNo;
                cardNumber.BatchNumber  = year.ToString() + Pin.BatchNumber.ToUpper();
                cardNumber.IsDisenabled = false;
                cardNumber.DateCreated  = DateTime.Now;
                cardNumber.UserDetails  = User.Identity.Name;
                cardNumber.Usage        = 3;
                db.Pincodes.Add(cardNumber);
                db.SaveChanges();
                ViewBag.Success   = Pin.Quantity;
                TempData["Check"] = "Ok";
            }
            return(RedirectToAction("Card", new { id = ViewBag.Success, batch = Pin.BatchNumber.ToUpper() }));
        }
Пример #7
0
    private bool CheckData(DataTable dt)
    {
        int    TotalCount = 0, SuccessCount = 0, FailCount = 0;
        string Message = string.Empty;

        try
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                TotalCount++;
                bool IsValid = true;
                int  CountryId = 0, StateId = 0, CityId = 0;

                string Connecter = " in Record-" + TotalCount.ToString() + ".<br />";

                #region Value Initialization

                CountryName = dt.Rows[i][CountryNameColumn].ToString().Trim();
                StateName   = dt.Rows[i][StateNameColumn].ToString().Trim();
                CityName    = dt.Rows[i][CityNameColumn].ToString().Trim();
                AreaName    = dt.Rows[i][AreaNameColumn].ToString().Trim();

                #endregion

                #region Check Country Name

                if (IsValid)
                {
                    if (CountryName.zIsNullOrEmpty())
                    {
                        Message += CS.Arrow + "Country Name Is Empty" + Connecter;
                        IsValid  = false;
                    }
                }

                if (IsValid)
                {
                    var lstCountry = new Country()
                    {
                        CountryName = CountryName.ToLower(), eStatus = (int)eStatus.Active,
                    }.SelectList <Country>();
                    if (lstCountry.Count == 0)
                    {
                        Message += CS.Arrow + "Country is Invalid" + Connecter;
                        IsValid  = false;
                    }
                    else
                    {
                        CountryId = lstCountry[0].CountryId.Value;
                    }
                }

                #endregion

                #region Check State Name

                if (IsValid)
                {
                    if (StateName.zIsNullOrEmpty())
                    {
                        Message += CS.Arrow + "State Name Is Empty" + Connecter;
                        IsValid  = false;
                    }
                }

                if (IsValid)
                {
                    var lstState = new State()
                    {
                        StateName = StateName.ToLower(), CountryId = CountryId, eStatus = (int)eStatus.Active
                    }.SelectList <State>();
                    if (lstState.Count == 0)
                    {
                        Message += CS.Arrow + "State is Invalid" + Connecter;
                        IsValid  = false;
                    }
                    else
                    {
                        StateId = lstState[0].StateId.Value;
                    }
                }

                #endregion

                #region Check City Name

                if (IsValid)
                {
                    if (CityName.zIsNullOrEmpty())
                    {
                        Message += CS.Arrow + "City Name Is Empty" + Connecter;
                        IsValid  = false;
                    }
                }

                if (IsValid)
                {
                    var lstCity = new City()
                    {
                        CityName = CityName.ToLower(), StateId = StateId, eStatus = (int)eStatus.Active
                    }.SelectList <City>();
                    if (lstCity.Count == 0)
                    {
                        Message += CS.Arrow + "City is Invalid" + Connecter;
                        IsValid  = false;
                    }
                    else
                    {
                        CityId = lstCity[0].StateId.Value;
                    }
                }

                #endregion

                #region Check Area Name

                if (IsValid)
                {
                    if (AreaName.zIsNullOrEmpty())
                    {
                        Message += CS.Arrow + "Area Name Is Empty" + Connecter;
                        IsValid  = false;
                    }
                }

                if (IsValid)
                {
                    string RepeateColumn = string.Empty;
                    if (CU.IsRepeateExcelRow(dt, i, AreaName, AreaNameColumn, CityName, CityNameColumn, StateName, StateNameColumn, ref RepeateColumn))
                    {
                        Message += CS.Arrow + "Area " + AreaName + " is Repeating in Record-" + RepeateColumn;
                        IsValid  = false;
                    }
                }

                if (IsValid)
                {
                    DataTable dtAreaName = new Query()
                    {
                        CountryId  = CountryId,
                        StateId    = StateId,
                        CityId     = CityId,
                        AreaName   = AreaName,
                        eStatusNot = (int)eStatus.Delete
                    }.Select(eSP.qry_Area);

                    if (dtAreaName.Rows.Count > 0 && !chkReplace.Checked)
                    {
                        string Status = dtAreaName.Rows[0][CS.eStatus].zToInt().Value == (int)eStatus.Deactive ? "(Deactive)" : string.Empty;
                        Message += CS.Arrow + AreaName + " Area is already exist" + Status + "." + Connecter;
                        IsValid  = false;
                    }
                }

                #endregion

                #region Check Pincode

                if (!Pincode.zIsNullOrEmpty())
                {
                    if (IsValid)
                    {
                        string RepeateColumn = string.Empty;
                        if (CU.IsRepeateExcelRow(dt, i, Pincode, PincodeColumn, string.Empty, null, string.Empty, null, ref RepeateColumn))
                        {
                            Message += CS.Arrow + "Pincode " + Pincode + " is Repeating in Record-" + RepeateColumn;
                            IsValid  = false;
                        }
                    }

                    if (IsValid)
                    {
                        DataTable dtAreaPincode = new Query()
                        {
                            Pincode    = Pincode,
                            eStatusNot = (int)eStatus.Delete
                        }.Select(eSP.qry_Area);

                        if (dtAreaPincode.Rows.Count > 0 && !chkReplace.Checked)
                        {
                            string Status = dtAreaPincode.Rows[0][CS.eStatus].zToInt().Value == (int)eStatus.Deactive ? "(Deactive)" : string.Empty;
                            Message += CS.Arrow + Pincode + " Pincode is already exist" + Status + "." + Connecter;
                            IsValid  = false;
                        }
                    }
                }

                #endregion

                if (IsValid)
                {
                    SuccessCount++;
                }
                else
                {
                    FailCount++;
                    if (FailCount >= 10)
                    {
                        break;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CU.ZMessage(eMsgType.Error, string.Empty, ex.Message, 0);
            return(false);
        }

        if (FailCount == 0)
        {
            return(true);
        }
        else
        {
            CU.SetErrorExcelMessage(Message, SuccessCount, FailCount);
            return(false);
        }
    }
        public void TrimData()
        {
            if (Name == null)
            {
                Name = "";
            }

            if (Address == null)
            {
                Address = "";
            }

            if (City == null)
            {
                City = "";
            }

            if (Pincode == null)
            {
                Pincode = "";
            }

            if (State == null)
            {
                State = "";
            }

            if (MaxAdultCount < 0)
            {
                MaxAdultCount = 0;
            }

            if (MaxChildrenCount < 0)
            {
                MaxChildrenCount = 0;
            }

            if (MaxRoomBookingDaysFromOnlinePortal < 0)
            {
                MaxRoomBookingDaysFromOnlinePortal = 0;
            }

            if (MaxRoomCountForSingleBookingFromOnlinePortal < 0)
            {
                MaxRoomCountForSingleBookingFromOnlinePortal = 0;
            }

            if (PriorDaysCountForOnlinePortal < 0)
            {
                PriorDaysCountForOnlinePortal = 0;
            }

            if (DaysCountForNextBookingFromOnlinePortal < 0)
            {
                DaysCountForNextBookingFromOnlinePortal = 0;
            }

            Name    = Name.Trim().ToUpper();
            Address = Address.Trim();
            City    = City.Trim();
            Pincode = Pincode.Trim();
            State   = State.Trim();
        }