Esempio n. 1
0
        /// <summary>
        /// Added By : Himanshu Pandya
        /// Date : 15-03-2013
        /// Desc : 
        /// </summary>
        public void BindKaymNidhiCustomerGrid()
        {
            ObjCustomerKayamNidhi = new clsCustomerKayamNidhi();
            dtCustomerKayamNidhi = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(txtSearchCustomerKayamNidhi.Text) && !string.IsNullOrEmpty(ddlKayamNidhiMonth.SelectedValue))
                {
                    string strsearch = ddlCustomerKayamNidhiSearch.SelectedValue.ToString();
                    switch (strsearch)
                    {
                        case "CustomerNo":
                            ObjCustomerKayamNidhi.CustomerCode = txtSearchCustomerKayamNidhi.Text.ToString();
                            break;
                        case "CusotmerName":
                            ObjCustomerKayamNidhi.FirstName = txtSearchCustomerKayamNidhi.Text.ToString();
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    ObjCustomerKayamNidhi.CustomerCode = string.Empty;
                    ObjCustomerKayamNidhi.FirstName = string.Empty;
                }

                if (!string.IsNullOrEmpty(ddlKayamNidhiYear.SelectedValue.ToString()))
                {
                    ObjCustomerKayamNidhi.KayamNidhiYear = Convert.ToInt32(ddlKayamNidhiYear.SelectedValue);
                }

                if (!string.IsNullOrEmpty(ddlKayamNidhiMonth.SelectedValue.ToString()))
                {
                    ObjCustomerKayamNidhi.KayamNidhiMonth = Convert.ToInt32(ddlKayamNidhiMonth.SelectedValue);
                }

                dtCustomerKayamNidhi = ObjCustomerKayamNidhi.SelectAllCustomerKayamNidhiWithSearch();
                if (dtCustomerKayamNidhi.Rows.Count > 0)
                {
                    gvCustomerKayamNidhi.DataSource = dtCustomerKayamNidhi;
                }
                else
                {
                    gvCustomerKayamNidhi.DataSource = null;
                }

                gvCustomerKayamNidhi.PageSize = Convert.ToInt32(ddlPager.SelectedValue.ToString());
                gvCustomerKayamNidhi.DataBind();

            }
            catch (Exception)
            {

                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomerKayamNidhi_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjCustomerKayamNidhi = new clsCustomerKayamNidhi();
            int iCustomerId, iAccountId;
            decimal iKayamNidhiAmt;
            try
            {
                iCustomerId = Convert.ToInt32(((Label)gvCustomerKayamNidhi.Rows[e.NewEditIndex].FindControl("lblCustomerId")).Text);
                iAccountId = Convert.ToInt32(((Label)gvCustomerKayamNidhi.Rows[e.NewEditIndex].FindControl("lblAccountId")).Text);
                iKayamNidhiAmt = Convert.ToDecimal(((Label)gvCustomerKayamNidhi.Rows[e.NewEditIndex].FindControl("lblCustomerKayamNidhiAmount")).Text);
                if ((iCustomerId > 0) && (iAccountId > 0))
                {
                    ObjCustomerKayamNidhi.CustomerId = iCustomerId;
                    ObjCustomerKayamNidhi.AccountId = iAccountId;
                    if (!string.IsNullOrEmpty(ddlKayamNidhiYear.SelectedValue.ToString()))
                    {
                        ObjCustomerKayamNidhi.KayamNidhiYear = Convert.ToInt32(ddlKayamNidhiYear.SelectedValue);
                    }

                    if (!string.IsNullOrEmpty(ddlKayamNidhiMonth.SelectedValue.ToString()))
                    {
                        ObjCustomerKayamNidhi.KayamNidhiMonth = Convert.ToInt32(ddlKayamNidhiMonth.SelectedValue);
                    }

                    ObjCustomerKayamNidhi.KayamNidhiDepositeDate = DateTime.UtcNow;
                    ObjCustomerKayamNidhi.KayamNidhiAmount = iKayamNidhiAmt;
                    ObjCustomerKayamNidhi.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                    ObjCustomerKayamNidhi.CreatedDate = DateTime.UtcNow;
                    ObjCustomerKayamNidhi.IsActive = true;
                    ObjCustomerKayamNidhi.Insert();
                    if (ObjCustomerKayamNidhi.CustomerKayamNidhiId > 0)
                    {
                        lblKayamNidhiMessage.CssClass = "SuccessfulMessage";
                        lblKayamNidhiMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavedSuccessfully");
                    }
                    else
                    {
                        lblKayamNidhiMessage.CssClass = "FailureMessage";
                        lblKayamNidhiMessage.Text = (String)GetGlobalResourceObject("SharedResource", "LoginSessionExpire");
                    }
                }
                BindKaymNidhiCustomerGrid();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ObjCustomerKayamNidhi = null;
            }
        }