protected void lnkPincode_Click(object sender, EventArgs e) { int res = 0; var oPin = new TMSLibrary.Pincode(); oPin.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value); oPin.Pin = Convert.ToInt32(txtpincode.Text); if (PinId == 0) { res = MasterDataMethods.Addpincode(oPin); } else if (PinId > 0) { oPin.PincodeId = PinId; res = MasterDataMethods.UpdatePincode(oPin); } if (res > 0) { PinId = 0; ClearInputs(Page.Controls); FillGrid(); ValidatePopup("Operation Successfull"); } else { ValidatePopup("Please Try Again"); } }
/// <summary> /// Adds a Pincode /// </summary> /// <param name="oCity"></param> /// <returns></returns> public static int Addpincode(Pincode oPincode) { return TMSDataLibrary.MasterData.AddPincode(oPincode.CityId, oPincode.Pin); }
/// <summary> /// Updates A Pincode Details /// </summary> /// <param name="oCity"></param> /// <returns></returns> public static int UpdatePincode(Pincode oPincode) { return TMSDataLibrary.MasterData.UpdatePincode(oPincode.CityId, oPincode.PincodeId, oPincode.Pin); }
/// <summary> /// Gets list of All Pincode /// </summary> /// <returns></returns> public static List<Pincode> GetPincode() { List<Pincode> pinlist = new List<Pincode>(); DataTable dt = TMSDataLibrary.MasterData.GetPincode(); if (dt.Rows.Count > 0) { int count = dt.Rows.Count; Pincode _pincode = new Pincode(); for (int i = 0; i <count; i++) { _pincode = new Pincode(); _pincode.PincodeId = Convert.ToInt32(dt.Rows[i][CONSTS.PincodeCoiumnIndex.PinId]); _pincode.CityId = Convert.ToInt32(dt.Rows[i][CONSTS.PincodeCoiumnIndex.CityId]); _pincode.CityName = (dt.Rows[i][CONSTS.PincodeCoiumnIndex.CityName]).ToString(); _pincode.Pin = Convert.ToInt32((dt.Rows[i][CONSTS.PincodeCoiumnIndex.Pincode])); pinlist.Add(_pincode); } } return pinlist; }