protected void lsvUserList_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            this.lblException.Text = "";
            this.lblResult.Text    = "";
            try
            {
                string CommandName     = e.CommandName.ToString();
                string CommandArgument = e.CommandArgument.ToString();

                if (CommandArgument.ToString() != "")
                {
                    long Value = long.Parse(CommandArgument.ToString());

                    if (CommandName == "edit")
                    {
                        GlobalClass.GovtInfoID = Value;
                        Response.Redirect("~/Pages/Admin/GovernmentKhasLandData.aspx", true);
                    }
                    else if (CommandName == "delete")
                    {
                        ALRD_GovernmentKhasLandDataEntity entity = new ALRD_GovernmentKhasLandDataEntity {
                            COMPID = Value
                        };
                        long i = ALRD_GovernmentKhasLandDataService.GetService().Delete(entity);
                        LoadEntityList(new ALRD_GovernmentKhasLandDataEntity());

                        SuccessMessage = "Information Deleted Successfully";
                    }
                }
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
        }
        private void LoadEntityList(ALRD_GovernmentKhasLandDataEntity entity)
        {
            try
            {
                if (entity.PageSize < 0)
                {
                    entity.PageSize = 10;
                }
                if (entity.SortExpression == string.Empty)
                {
                    entity.SortExpression = "OrgName ASC";
                }

                LocalEntityList = ALRD_GovernmentKhasLandDataService.GetService().GetAll(entity).ToList();
                if (LocalEntityList != null && LocalEntityList.Count > 0)
                {
                    lsvUserList.DataSource = LocalEntityList;
                    lsvUserList.DataBind();
                }
                else
                {
                    lsvUserList.DataSource = null;
                    lsvUserList.DataBind();
                }
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
        }
Ejemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.lblException.Text = "";
            this.lblResult.Text    = "";
            try
            {
                if (btnSave.Text == "Save")
                {
                    ALRD_GovernmentKhasLandDataEntity entity = BuiltEntity();
                    long i = ALRD_GovernmentKhasLandDataService.GetService().Add(entity);
                    if (i > 0)
                    {
                        SuccessMessage = "Information Saved Successfully";
                        LoadEntity(new ALRD_GovernmentKhasLandDataEntity {
                            COMPID = i
                        });
                    }
                }
                else
                {
                    ALRD_GovernmentKhasLandDataEntity entity = BuiltEntity();

                    long i = ALRD_GovernmentKhasLandDataService.GetService().Update(entity);
                    if (i > 0)
                    {
                        SuccessMessage = "Information Updated Successfully";
                        LoadEntity(new ALRD_GovernmentKhasLandDataEntity {
                            COMPID = entity.COMPID
                        });
                    }
                }

                DateTime currentDate = DateTime.Now;
                ddlYear.SelectedValue  = currentDate.Year.ToString();
                ddlMonth.SelectedValue = currentDate.Month.ToString();
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
        }
Ejemplo n.º 4
0
        private void LoadEntity(ALRD_GovernmentKhasLandDataEntity entity)
        {
            try
            {
                ALRD_GovernmentKhasLandDataEntity objEntity = ALRD_GovernmentKhasLandDataService.GetService().GetAll(entity).FirstOrDefault();

                ClearControlStates(pnlForm);

                if (objEntity != null && objEntity.COMPID != null && objEntity.COMPID > 0)
                {
                    GlobalClass.FormUserID = (long)objEntity.COMPID;

                    hdnCOMPID.Value = objEntity.COMPID.ToString();
                    if (objEntity.CollCollectionYear.HasValue)
                    {
                        ddlYear.SelectedValue = objEntity.CollCollectionYear.ToString();
                    }
                    if (objEntity.CollectionMonth.HasValue)
                    {
                        ddlMonth.SelectedValue = objEntity.CollectionMonth.ToString();
                    }

                    if (objEntity.DivisionID.HasValue)
                    {
                        ddlDivision.SelectedValue = objEntity.DivisionID.ToString();
                    }

                    ddlDivision_SelectedIndexChanged(null, null);

                    if (objEntity.DistrictID.HasValue && ddlDistrict.Items.FindByValue(objEntity.DistrictID.ToString()) != null)
                    {
                        ddlDistrict.SelectedValue = objEntity.DistrictID.ToString();
                    }

                    ddlDistrict_SelectedIndexChanged(null, null);

                    if (objEntity.UpazilaID.HasValue && ddlUpazilla.Items.FindByValue(objEntity.UpazilaID.ToString()) != null)
                    {
                        ddlUpazilla.SelectedValue = objEntity.UpazilaID.ToString();
                    }

                    txtRemarks.Text = objEntity.Remarks;

                    if (objEntity.TotalKhasLandAgri.HasValue)
                    {
                        txtTotalKhasLandAgri.Text = objEntity.TotalKhasLandAgri.ToString();
                    }
                    if (objEntity.TotalKhasLandNonAgri.HasValue)
                    {
                        txtTotalKhasLandNonAgri.Text = objEntity.TotalKhasLandNonAgri.ToString();
                    }
                    if (objEntity.DistributedKhasLandAgri.HasValue)
                    {
                        txtDistributedKhasLandAgri.Text = objEntity.DistributedKhasLandAgri.ToString();
                    }
                    if (objEntity.DistributedKhasLandNonAgri.HasValue)
                    {
                        txtDistributedKhasLandNonAgri.Text = objEntity.DistributedKhasLandNonAgri.ToString();
                    }
                    if (objEntity.DistributableKhasLandAgri.HasValue)
                    {
                        txtDistributableKhasLandAgri.Text = objEntity.DistributableKhasLandAgri.ToString();
                    }
                    if (objEntity.DistributableKhasLandNonAgri.HasValue)
                    {
                        txtDistributableKhasLandNonAgri.Text = objEntity.DistributableKhasLandNonAgri.ToString();
                    }
                    if (objEntity.NoOfFamilyGotKhasLandAgri.HasValue)
                    {
                        txtNoOfFamilyGotKhasLandAgri.Text = objEntity.NoOfFamilyGotKhasLandAgri.ToString();
                    }
                    if (objEntity.NoOfFamilyGotKhasLandNonAgri.HasValue)
                    {
                        txtNoOfFamilyGotKhasLandNonAgri.Text = objEntity.NoOfFamilyGotKhasLandNonAgri.ToString();
                    }
                    if (objEntity.IllegalOccupiedKhasLandAgri.HasValue)
                    {
                        txtIllegalOccupiedKhasLandAgri.Text = objEntity.IllegalOccupiedKhasLandAgri.ToString();
                    }
                    if (objEntity.IllegalOccupiedKhasLandNonAgri.HasValue)
                    {
                        txtIllegalOccupiedKhasLandNonAgri.Text = objEntity.IllegalOccupiedKhasLandNonAgri.ToString();
                    }
                    if (objEntity.KhasLandWithSuitCaseAgri.HasValue)
                    {
                        txtKhasLandWithSuitCaseAgri.Text = objEntity.KhasLandWithSuitCaseAgri.ToString();
                    }


                    if (objEntity.KhasLandWithSuitCaseNonAgri.HasValue)
                    {
                        txtKhasLandWithSuitCaseNonAgri.Text = objEntity.KhasLandWithSuitCaseNonAgri.ToString();
                    }


                    if (objEntity.CreatedBy.HasValue)
                    {
                        hdnCreatedBy.Value = objEntity.CreatedBy.ToString();
                    }
                    hdnCreatedOn.Value = GetStringFromDate(objEntity.CreatedOn);

                    btnSave.Text          = "Update";
                    btnSave.OnClientClick = "javascript:return validateSubmit('Do you want to update this information?');";
                    this.CheckButtonPermission(null, btnSave, null);
                }
                else
                {
                    GlobalClass.FormUserID = -99;
                    btnSave.Text           = "Save";
                    btnSave.OnClientClick  = "javascript:return validateSubmit('Do you want to save this information?');";
                    this.CheckButtonPermission(btnSave, null, null);

                    DateTime currentDate = DateTime.Now;
                    ddlYear.SelectedValue  = currentDate.Year.ToString();
                    ddlMonth.SelectedValue = currentDate.Month.ToString();
                }
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
        }