Example #1
0
        private void BindGrid(bool addRow, bool deleteRow)
        {
            CropsBLL CropsBLLobj = new CropsBLL();

            grdCrops.DataSource = CropsBLLobj.GetCrops(Convert.ToInt32(Session["HH_ID"]));
            grdCrops.DataBind();
        }
Example #2
0
        private void DeleteData(string cropid)
        {
            CropsBLL CropsBLLobj = new CropsBLL();

            int Result = 0;

            if (cropid != null)
            {
                Result = CropsBLLobj.DeleteData(cropid);
            }
        }
Example #3
0
        private void GetData()
        {
            CropsBLL BLLobj = new CropsBLL();
            int      CropId = 0;

            if (ViewState["PAP_CROPID"] != null)
            {
                CropId = Convert.ToInt32(ViewState["PAP_CROPID"]);
            }

            CropsBO BOobj = new CropsBO();

            BOobj = BLLobj.GetData(CropId);

            txtbxPAP_CROPID.Text = BOobj.PAP_CROPID.ToString();

            ddlCropName.ClearSelection();
            if (ddlCropName.Items.FindByValue(BOobj.CROPID.ToString()) != null)
            {
                ddlCropName.Items.FindByValue(BOobj.CROPID.ToString()).Selected = true;
            }

            ddlCropType.ClearSelection();
            if (ddlCropType.Items.FindByValue(BOobj.CROPTYPEID.ToString()) != null)
            {
                ddlCropType.Items.FindByValue(BOobj.CROPTYPEID.ToString()).Selected = true;
            }

            ddlCropDescription.ClearSelection();
            if (ddlCropDescription.Items.FindByValue(BOobj.CROPDESCRIPTIONID.ToString()) != null)
            {
                ddlCropDescription.Items.FindByValue(BOobj.CROPDESCRIPTIONID.ToString()).Selected = true;
            }

            lblUnitMeasure.Text = GetUnitName(ddlCropName.SelectedValue + "|" + ddlCropDescription.SelectedValue)[0];

            txtbxQuantity.Text = UtilBO.CurrencyFormat(BOobj.QUANTITY);

            txtbxCropRate.Text = UtilBO.CurrencyFormat(BOobj.CROPRATE);

            txtbxCropvaluation.Text = UtilBO.CurrencyFormat(BOobj.QUANTITY * BOobj.CROPRATE);


            CommentsTextBox.Text = BOobj.COMMENTS;
        }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (txtbxPAP_CROPID.Text.ToString().Trim() == string.Empty)
            {
                CropsBLL BLLobj = new CropsBLL();

                try
                {
                    string  uID      = Session["USER_ID"].ToString();
                    string  hhid     = Session["HH_ID"].ToString();
                    CropsBO Cropsobj = new CropsBO();

                    Cropsobj.HHID              = Convert.ToInt32(hhid);
                    Cropsobj.CROPID            = Convert.ToInt32(ddlCropName.SelectedValue);
                    Cropsobj.CROPTYPEID        = Convert.ToInt32(ddlCropType.SelectedValue);
                    Cropsobj.CROPDESCRIPTIONID = Convert.ToInt32(ddlCropDescription.SelectedValue);
                    Cropsobj.QUANTITY          = Convert.ToDecimal(txtbxQuantity.Text);
                    Cropsobj.CROPRATE          = Convert.ToDecimal(txtbxCropRate.Text);

                    if (CommentsTextBox.Text.Length > 1000)
                    {
                        Cropsobj.COMMENTS = CommentsTextBox.Text.Substring(0, 1000);
                    }
                    else
                    {
                        Cropsobj.COMMENTS = CommentsTextBox.Text;
                    }
                    Cropsobj.ISDELETED = "False";
                    Cropsobj.CREATEDBY = Convert.ToInt32(uID);

                    if (photoFileUpload.HasFile)
                    {
                        byte[] fileBytes = photoFileUpload.FileBytes;

                        if (fileBytes != null)
                        {
                            Cropsobj.Photo = fileBytes;
                        }
                    }

                    CropsBLL CropsBLLobj1 = new CropsBLL();
                    count = CropsBLLobj1.Insert(Cropsobj);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "ShowSaveMessage('');", true);

                    BindGrid(true, true);
                    ClearData();
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    BLLobj = null;
                }
            }
            else if (txtbxPAP_CROPID.Text.ToString() != string.Empty)
            {
                CropsBLL BLLobj = new CropsBLL();

                try
                {
                    string  uID      = Session["USER_ID"].ToString();
                    string  hhid     = Session["HH_ID"].ToString();
                    CropsBO Cropsobj = new CropsBO();

                    Cropsobj.HHID = Convert.ToInt32(hhid);

                    Cropsobj.PAP_CROPID = Convert.ToInt32(txtbxPAP_CROPID.Text);
                    Cropsobj.CROPID     = Convert.ToInt32(ddlCropName.SelectedValue);

                    Cropsobj.CROPTYPEID        = Convert.ToInt32(ddlCropType.SelectedValue);
                    Cropsobj.CROPDESCRIPTIONID = Convert.ToInt32(ddlCropDescription.SelectedValue);

                    Cropsobj.QUANTITY = Convert.ToDecimal(txtbxQuantity.Text);
                    Cropsobj.CROPRATE = Convert.ToDecimal(txtbxCropRate.Text);

                    Cropsobj.CROPVALUATION = Cropsobj.QUANTITY * Cropsobj.CROPRATE;

                    if (CommentsTextBox.Text.Length > 1000)
                    {
                        Cropsobj.COMMENTS = CommentsTextBox.Text.Substring(0, 1000);
                    }
                    else
                    {
                        Cropsobj.COMMENTS = CommentsTextBox.Text;
                    }

                    Cropsobj.ISDELETED = "False";
                    Cropsobj.CREATEDBY = Convert.ToInt32(uID);
                    if (photoFileUpload.HasFile)
                    {
                        byte[] fileBytes = photoFileUpload.FileBytes;
                        Cropsobj.Photo = fileBytes;
                    }
                    CropsBLL CropsBLLobj1 = new CropsBLL();
                    count = CropsBLLobj1.UpdateData(Cropsobj);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "ShowUpdateMessage('');", true);

                    BindGrid(true, true);
                    ClearData();
                    SetUpdateMode(false);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    BLLobj = null;
                }
            }
            ChangeRequestStatusValuationCrop();
            projectFrozen();
        }