Beispiel #1
0
        private void BindCity()
        {
            try
            {
                CityMastDAL obj = new CityMastDAL();
                var         lst = obj.SelectCityCombo();
                obj = null;
                drpCityFrom.DataSource     = lst;
                drpCityFrom.DataTextField  = "City_Name";
                drpCityFrom.DataValueField = "City_Idno";
                drpCityFrom.DataBind();
                drpCityFrom.Items.Insert(0, new ListItem("--Select--", "0"));

                BindDropdownDAL obj2   = new BindDropdownDAL();
                var             ToCity = obj2.BindAllToCity();
                obj2 = null;

                ddlCity.DataSource     = ToCity;
                ddlCity.DataTextField  = "city_name";
                ddlCity.DataValueField = "city_idno";
                ddlCity.DataBind();
                ddlCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
            }
            catch (Exception Ex)
            {
            }
        }
Beispiel #2
0
        private void BindGrid()
        {
            CityMastDAL objclsCityMaster = new CityMastDAL();
            var         lstGridData      = objclsCityMaster.SelectForSearch(Convert.ToString(txtCityName.Text.Trim()), Convert.ToInt32(drpState.SelectedValue), Convert.ToInt32(ddlLoc.SelectedValue));

            objclsCityMaster = null;
            if (lstGridData != null && lstGridData.Count > 0)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("SrNo", typeof(string));
                dt.Columns.Add("State", typeof(string));
                dt.Columns.Add("City", typeof(string));
                dt.Columns.Add("AsLocation", typeof(string));
                dt.Columns.Add("Abbrev", typeof(string));


                double TNet = 0; double TAmnt = 0;
                for (int i = 0; i < lstGridData.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["SrNo"]       = Convert.ToString(i + 1);
                    dr["State"]      = Convert.ToString(DataBinder.Eval(lstGridData[i], "StateName"));
                    dr["City"]       = Convert.ToString(DataBinder.Eval(lstGridData[i], "CityName"));
                    dr["AsLocation"] = Convert.ToString(DataBinder.Eval(lstGridData[i], "AsLoc"));
                    dr["Abbrev"]     = Convert.ToString(DataBinder.Eval(lstGridData[i], "Abbreviation"));

                    dt.Rows.Add(dr);
                }
                if (dt != null && dt.Rows.Count > 0)
                {
                    ViewState["Dt"] = dt;
                }


                //
                grdMain.DataSource = lstGridData;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + lstGridData.Count;
                imgBtnExcel.Visible = false;
                print.Visible       = false;

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text    = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + lstGridData.Count.ToString();
                lblcontant.Visible = true;
                divpaging.Visible  = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): 0 ";
                imgBtnExcel.Visible = false;
                divpaging.Visible   = false;
                lblcontant.Visible  = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            con = ApplicationFunction.ConnectionString();
            if (Request.QueryString["FTyp"] != null)
            {
                HidInvoiceTyp.Value = Convert.ToString(Request.QueryString["FTyp"]);
            }
            if (!Page.IsPostBack)
            {
                if (base.CheckUserRights(intFormId) == false)
                {
                    Response.Redirect("PermissionDenied.aspx");
                }
                if (base.View == false)
                {
                    lnkbtnPreview.Visible = false;
                }
                this.BindDateRange();
                ddlDateRange.SelectedIndex = 0;
                Int32 intYearIdno = Convert.ToInt32(ddlDateRange.SelectedValue);
                this.BindItems();

                this.BindParty();
                SetDate();
                if (Convert.ToString(Session["Userclass"]) == "Admin")
                {
                    CityMastDAL obj = new CityMastDAL();
                    var         lst = obj.SelectCityCombo();
                    obj = null;
                    drpBaseCity.DataSource     = lst;
                    drpBaseCity.DataTextField  = "City_Name";
                    drpBaseCity.DataValueField = "City_Idno";
                    drpBaseCity.DataBind();
                    drpBaseCity.Items.Insert(0, new ListItem("--Select--", "0"));
                }
                else
                {
                    this.BindCity(Convert.ToInt64(Session["UserIdno"]));
                }

                userpref();
                imgBtnExcel.Visible = false;
            }


            txtDateFrom.Attributes.Add("onkeypress", "return notAllowAnything(event);");
            txtDateTo.Attributes.Add("onkeypress", "return notAllowAnything(event);");

            HidFrmCityIdno.Value = drpBaseCity.SelectedValue;
            ddlDateRange.Focus();
            userpref();
        }
        protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            Int32       empIdno          = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string      strMsg           = string.Empty;
            CityMastDAL objclsCityMaster = new CityMastDAL();
            Int64       intCityIdno      = 0;

            if (!chkLocation.Checked)
            {
                txtGSTIN_No.Text = String.Empty;
            }
            if (string.IsNullOrEmpty(hidcityidno.Value) == true)
            {
                intCityIdno = objclsCityMaster.InsertCityMaster(txtCityName.Text.Trim(), txtNameHindi.Text.Trim(), txtAbbreviation.Text.Trim(), Convert.ToInt64(drpState.SelectedValue), Convert.ToBoolean(chkStatus.Checked), Convert.ToBoolean(chkLocation.Checked), empIdno, txtGSTIN_No.Text, txtCodeSap.Text, txtSACCode.Text, txtadd1.Text, txtadd2.Text);
            }
            else
            {
                intCityIdno = objclsCityMaster.UpdateCityMaster(txtCityName.Text.Trim(), txtNameHindi.Text.Trim(), txtAbbreviation.Text.Trim(), Convert.ToInt64(drpState.SelectedValue), Convert.ToInt32(hidcityidno.Value), Convert.ToBoolean(chkStatus.Checked), Convert.ToBoolean(chkLocation.Checked), empIdno, txtGSTIN_No.Text, txtCodeSap.Text, txtSACCode.Text, txtadd1.Text, txtadd2.Text);
            }
            objclsCityMaster = null;

            if (intCityIdno > 0)
            {
                if (string.IsNullOrEmpty(hidcityidno.Value) == false)
                {
                    ShowMessage("Record updated successfully.");
                    lnkbtnNew.Visible = false;
                }
                else
                {
                    ShowMessage("Record saved successfully.");
                }
                this.ClearControls();
            }
            else if (intCityIdno == -2)
            {
                ShowMessageErr("Location limit defined in comapny Master is [ " + Convert.ToString(base.CompLocationLimit) + " ]");
            }
            else if (intCityIdno < 0)
            {
                ShowMessageErr("Record already exists.");
            }
            else
            {
                if (string.IsNullOrEmpty(hidcityidno.Value) == false)
                {
                    ShowMessageErr("Record not updated.");
                }
                else
                {
                    ShowMessageErr("Record not saved.");
                }
            }
            ClearControls();
            drpState.Focus();
        }
        private void BindState()
        {
            CityMastDAL obj = new CityMastDAL();
            var         lst = obj.SelectState();

            ddlState.DataSource     = lst;
            ddlState.DataTextField  = "State_Name";
            ddlState.DataValueField = "State_Idno";
            ddlState.DataBind();
            ddlState.Items.Insert(0, new ListItem("< Choose State >", "0"));
        }
Beispiel #6
0
        /// <summary>
        /// To Bind State DropDown
        /// </summary>
        private void BindState()
        {
            CityMastDAL objclsCityMaster = new CityMastDAL();
            var         objCityMast      = objclsCityMaster.SelectState();

            objclsCityMaster        = null;
            drpState.DataSource     = objCityMast;
            drpState.DataTextField  = "State_Name";
            drpState.DataValueField = "State_Idno";
            drpState.DataBind();
            drpState.Items.Insert(0, new ListItem(" ----Select---- ", "0"));
        }
        private void BindCity()
        {
            CityMastDAL OBJCityStateBLL = new CityMastDAL();
            var         lst             = OBJCityStateBLL.SelectCityCombo();

            OBJCityStateBLL        = null;
            ddlCity.DataSource     = lst;
            ddlCity.DataTextField  = "City_Name";
            ddlCity.DataValueField = "City_Idno";
            ddlCity.DataBind();
            ddlCity.Items.Insert(0, new ListItem("< Choose City >", "0"));
        }
        private void BindCity()
        {
            CityMastDAL obj = new CityMastDAL();
            var         lst = obj.SelectCityCombo();

            obj = null;
            drpCityFrom.DataSource     = lst;
            drpCityFrom.DataTextField  = "City_Name";
            drpCityFrom.DataValueField = "City_Idno";
            drpCityFrom.DataBind();
            drpCityFrom.Items.Insert(0, new ListItem("--Select--", "0"));
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            if (!Page.IsPostBack)
            {
                if (base.CheckUserRights(intFormId) == false)
                {
                    Response.Redirect("PermissionDenied.aspx");
                }
                if (base.ADD == false)
                {
                    lnkbtnSave.Visible = false;
                }
                this.BindDateRange();
                this.BindCity();
                ddlDateRange.SelectedValue = Convert.ToString(base.UserDateRng);
                ddlDateRange.SelectedIndex = 0;
                ddlDateRange_SelectedIndexChanged(null, null);
                txtDateRate.Text = DateTime.Now.ToString("dd-MM-yyyy");
                this.BindLorryType();
                txtfrghtAmount.Attributes.Add("onkeypress", "return allowOnlyFloatNumber(event);");

                txtfrghtAmount.Attributes.Add("onChange", "SetNumFormt('" + txtfrghtAmount.ClientID + "')");

                if (Convert.ToString(Session["Userclass"]) == "Admin")
                {
                    CityMastDAL obj = new CityMastDAL();
                    var         lst = obj.SelectCityCombo();
                    obj = null;
                    drpBaseCity.DataSource     = lst;
                    drpBaseCity.DataTextField  = "City_Name";
                    drpBaseCity.DataValueField = "City_Idno";
                    drpBaseCity.DataBind();
                    drpBaseCity.Items.Insert(0, new ListItem("--Select--", "0"));
                }
                else
                {
                    this.BindCity(Convert.ToInt64(Session["UserIdno"]));
                }
                userpref();
                drpBaseCity.SelectedValue = Convert.ToString(base.UserFromCity);
            }
            HidFrmCityIdno.Value = drpBaseCity.SelectedValue;
            ddlDateRange.Focus();
        }
Beispiel #10
0
        private void RecordCount()
        {
            CityMastDAL objclsCityMaster = new CityMastDAL();
            Int64       lstGridData      = objclsCityMaster.Count();

            objclsCityMaster = null;
            if (lstGridData != null && lstGridData > 0)
            {
                lblTotalRecord.Text = "T. Record (s): " + lstGridData;
                imgBtnExcel.Visible = false;
            }
            else
            {
                lblTotalRecord.Text = "T. Record (s): 0 ";
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.UrlReferrer == null)
     {
         base.AutoRedirect();
     }
     con = ApplicationFunction.ConnectionString();
     if (!Page.IsPostBack)
     {
         if (base.CheckUserRights(intFormId) == false)
         {
             Response.Redirect("PermissionDenied.aspx");
         }
         if (base.ADD == false)
         {
             lnkbtnSave.Visible = false;
         }
         if (Convert.ToString(Session["Userclass"]) == "Admin")
         {
             CityMastDAL obj = new CityMastDAL();
             var         lst = obj.SelectCityCombo();
             obj = null;
             drpBaseCity.DataSource     = lst;
             drpBaseCity.DataTextField  = "City_Name";
             drpBaseCity.DataValueField = "City_Idno";
             drpBaseCity.DataBind();
             drpBaseCity.Items.Insert(0, new ListItem("--Select--", "0"));
         }
         else
         {
             this.BindCity(Convert.ToInt64(Session["UserIdno"]));
         }
         this.BindDateRange();
         ddlDateRange.SelectedIndex = 0;
         hidsave.Value = "0";
         // ddlDateRange_SelectedIndexChanged(null, null);
         Int32 intYearIdno = Convert.ToInt32(ddlDateRange.SelectedValue);
         txtDateRate.Text = DateTime.Now.ToString("dd-MM-yyyy");
         this.BindItems();
         BindState();
         txtCommsision.Enabled = true;
         userpref();
         drpBaseCity.SelectedValue = Convert.ToString(iFromCity);
         txtDateRate.Attributes.Add("onkeypress", "return notAllowAnything(event);");
         txtCommsision.Attributes.Add("onkeypress", "return allowOnlyFloatNumber(event);");
     }
 }
Beispiel #12
0
        /// <summary>
        /// To Populate all controls
        /// </summary>
        /// <param name="DistrictIdno"></param>
        private void Populate(int DistrictIdno)
        {
            CityMastDAL objclsCityMaster = new CityMastDAL();
            var         objCityMast      = objclsCityMaster.SelectById(DistrictIdno);

            objclsCityMaster = null;
            if (objCityMast != null)
            {
                drpState.SelectedValue = Convert.ToString(objCityMast.State_Idno);
                txtDistrictName.Text   = Convert.ToString(objCityMast.City_Name);
                txtNameHindi.Text      = Convert.ToString(objCityMast.CityName_Hindi);
                txtAbbreviation.Text   = Convert.ToString(objCityMast.City_Abbr);
                chkStatus.Checked      = Convert.ToBoolean(objCityMast.Status);
                hiddistrictidno.Value  = Convert.ToString(objCityMast.City_Idno);
                //chkLocation.Checked = Convert.ToBoolean(objCityMast.AsLocation);
                drpState.Focus();
            }
        }
        /// <summary>
        /// To Populate all controls
        /// </summary>
        /// <param name="CityIdno"></param>
        private void Populate(int CityIdno)
        {
            CityMastDAL objclsCityMaster = new CityMastDAL();
            var         objCityMast      = objclsCityMaster.SelectById(CityIdno);

            objclsCityMaster = null;
            if (objCityMast != null)
            {
                drpState.SelectedValue = Convert.ToString(objCityMast.State_Idno);
                txtCityName.Text       = Convert.ToString(objCityMast.City_Name);
                txtGSTIN_No.Text       = Convert.ToString(objCityMast.GSTIN_No == null ? "" : objCityMast.GSTIN_No);
                txtNameHindi.Text      = Convert.ToString(objCityMast.CityName_Hindi);
                txtAbbreviation.Text   = Convert.ToString(objCityMast.City_Abbr);
                chkStatus.Checked      = Convert.ToBoolean(objCityMast.Status);
                hidcityidno.Value      = Convert.ToString(objCityMast.City_Idno);
                chkLocation.Checked    = Convert.ToBoolean(objCityMast.AsLocation);
                txtSACCode.Text        = Convert.ToString(objCityMast.sac_Code == null ? "" : objCityMast.sac_Code);
                txtCodeSap.Text        = Convert.ToString(objCityMast.Code_sap == null ? "" : objCityMast.Code_sap);
                txtadd1.Text           = Convert.ToString(objCityMast.Address1 == null ? "" : objCityMast.Address1);
                txtadd2.Text           = Convert.ToString(objCityMast.Address2 == null ? "" : objCityMast.Address2);
                drpState.Focus();
            }
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            con = ApplicationFunction.ConnectionString();
            if (Request.QueryString["FTyp"] != null)
            {
                HidInvoiceTyp.Value = Convert.ToString(Request.QueryString["FTyp"]);
            }
            if (!Page.IsPostBack)
            {
                //if (base.CheckUserRights(intFormId) == false)
                //{
                //    Response.Redirect("PermissionDenied.aspx");
                //}
                //if (base.ADD == false)
                //{
                //    lnkbtnSave.Visible = false;
                //}
                this.BindDateRange();
                this.BindTranType();
                ddlDateRange.SelectedValue = Convert.ToString(base.UserDateRng);
                ddlDateRange.SelectedIndex = 0;
                Int32 intYearIdno = Convert.ToInt32(ddlDateRange.SelectedValue);
                //txtDateRate.Text = DateTime.Now.ToString("dd-MM-yyyy");
                this.BindItems();
                this.BindCity();
                this.BindViaCity();
                this.BindParty();
                if (Convert.ToString(Session["Userclass"]) == "Admin")
                {
                    CityMastDAL obj = new CityMastDAL();
                    var         lst = obj.SelectCityCombo();
                    obj = null;
                    drpBaseCity.DataSource     = lst;
                    drpBaseCity.DataTextField  = "City_Name";
                    drpBaseCity.DataValueField = "City_Idno";
                    drpBaseCity.DataBind();
                    drpBaseCity.Items.Insert(0, new ListItem("--Select--", "0"));
                }
                else
                {
                    this.BindCity(Convert.ToInt64(Session["UserIdno"]));
                }

                userpref();
                //if (IsWeight == true)
                //{
                //    txt_Weight.Visible = true;
                //    rfv_Weight.Enabled = true;
                //    lblWeight.Visible = true;
                //}
                //else
                //{
                //    txt_Weight.Visible = false;
                //    lblWeight.Visible = false;
                //    rfv_Weight.Enabled = false;
                //}
                drpBaseCity.SelectedValue = Convert.ToString(base.UserFromCity);
            }


            if (Request.QueryString["RateIdno"] != null)
            {
                //Populate(Convert.ToInt32(Request.QueryString["RateIdno"]));
            }
            txtDateRate.Attributes.Add("onkeypress", "return notAllowAnything(event);");
            txtItemRate.Attributes.Add("onkeypress", "return allowOnlyFloatNumber(event);");
            txt_Weight.Attributes.Add("onkeypress", "return allowOnlyFloatNumber(event);");
            txtItemRate.Attributes.Add("onChange", "SetNumFormt('" + txtItemRate.ClientID + "')");
            txt_Weight.Attributes.Add("onChange", "SetNumFormt('" + txtItemRate.ClientID + "')");
            HidFrmCityIdno.Value = drpBaseCity.SelectedValue;
            ddlDateRange.Focus();
            userpref();
            //if (IsWeight == true)
            //{
            //    txt_Weight.Visible = true;
            //    rfv_Weight.Enabled = true;
            //    lblWeight.Visible = true;
            //}
            //else
            //{
            //    txt_Weight.Visible = false;
            //    lblWeight.Visible = false;
            //    rfv_Weight.Enabled = false;
            //}
        }
Beispiel #15
0
        protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton imgBtnStatus = (ImageButton)e.Row.FindControl("imgBtnStatus");
                bool        status       = Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "Status"));
                //ImageButton imgBtnEdit = (ImageButton)e.Row.FindControl("imgBtnEdit");
                ////ImageButton imgBtnDelete = (ImageButton)e.Row.FindControl("imgBtnDelete");
                //base.CheckUserRights(intFormId);
                //if (base.Edit == false)
                //{
                imgBtnStatus.Visible = true;
                //    imgBtnEdit.Visible = false;
                //    grdMain.Columns[4].Visible = false;
                //}
                ////if (base.Delete == false)
                ////{
                ////    imgBtnDelete.Visible = false;
                ////}
                //if ((base.Edit == false) && (base.Delete == false))
                //{
                //    grdMain.Columns[5].Visible = false;
                //}
                if (status == false)
                {
                    imgBtnStatus.ImageUrl = "~/Images/inactive.png";
                }
                else
                {
                    imgBtnStatus.ImageUrl = "~/Images/active.png";
                }

                string AsLoc  = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "AsLoc"));
                Label  lblLoc = (Label)e.Row.FindControl("lblLoc");
                if (AsLoc == "True")
                {
                    lblLoc.Text = "Yes";
                }
                else
                {
                    lblLoc.Text = "No";
                }
                // Used to hide Delete button if ItemgrpId exists in Rate Master,Ledger Accounts,Employee Master, Commission Master,Distance Master,Toll Tax Master,Petrol Pump Master,Goods Received,Quotation,GR Preparation,F. Mgmt ------->Opening Stock [Tyre],Purchase Bill,Material Issue,Trip Start
                LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                string     CityIdno     = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "CityIdno"));
                if (CityIdno != "")
                {
                    CityMastDAL obj       = new CityMastDAL();
                    var         ItemExist = obj.CheckItemExistInOtherMaster(Convert.ToInt32(CityIdno));
                    if (ItemExist != null && ItemExist.Count > 0)
                    {
                        lnkbtnDelete.Visible = false;
                    }
                    else
                    {
                        lnkbtnDelete.Visible = true;
                    }
                }
                // end----
            }
        }
Beispiel #16
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Int32  empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string strMsg  = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("CityMaster.aspx?CityIdno=" + e.CommandArgument, true);
            }
            if (e.CommandName == "cmddelete")
            {
                CityMastDAL objclsCityMaster = new CityMastDAL();
                Int32       intValue         = objclsCityMaster.Delete(Convert.ToInt32(e.CommandArgument));
                objclsCityMaster = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    drpState.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
            else if (e.CommandName == "cmdstatus")
            {
                int      intCityIdno = 0;
                bool     bStatus     = false;
                string[] strStatus   = Convert.ToString(e.CommandArgument).Split(new char[] { '_' });
                if (strStatus.Length > 1)
                {
                    intCityIdno = Convert.ToInt32(strStatus[0]);
                    if (Convert.ToBoolean(strStatus[1]) == true)
                    {
                        bStatus = false;
                    }
                    else
                    {
                        bStatus = true;
                    }
                    CityMastDAL objclsCityMaster = new CityMastDAL();
                    int         value            = objclsCityMaster.UpdateStatus(intCityIdno, bStatus, empIdno);
                    objclsCityMaster = null;
                    if (value > 0)
                    {
                        this.BindGrid();
                        strMsg = "Status updated successfully.";
                        drpState.Focus();
                    }
                    else
                    {
                        strMsg = "Status not updated.";
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
                }
            }
            drpState.Focus();
        }