コード例 #1
0
        /// <summary>
        ///  to get Image File for DataBase
        /// </summary>
        /// <param name="householdID"></param>
        /// <param name="PermanentStructureID"></param>
        /// <returns></returns>
        public CropsBO ShowPAPCROPImage(int householdID, int PermanentStructureID)
        {
            OracleConnection myConnection;
            OracleCommand    myCommand;

            myConnection          = new OracleConnection(AppConfiguration.ConnectionString);
            myCommand             = new OracleCommand("USP_TRN_GET_PAPCROP_PHOTO", myConnection);
            myCommand.Connection  = myConnection;
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.Add("HHID_", householdID);
            myCommand.Parameters.Add("PermanentStructureID_", PermanentStructureID);
            myCommand.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            myCommand.Connection.Open();
            object img = myCommand.ExecuteScalar();

            try
            {
                byte[] papPhotoBytes = (byte[])img;

                CropsBO objDAMAGEDCROPSImage = new CropsBO();
                objDAMAGEDCROPSImage.Photo = papPhotoBytes;

                return(objDAMAGEDCROPSImage);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                myConnection.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// To fetch details
        /// </summary>
        /// <param name="householdID"></param>
        /// <returns></returns>
        public CropsList GetCrops(int householdID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_TRN_SEL_CROPS";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("HHID_", householdID);
            cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();
            OracleDataReader dr       = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            CropsBO          Cropsobj = null;
            CropsList        Listobj  = new CropsList();

            while (dr.Read())
            {
                Cropsobj = new CropsBO();

                Cropsobj.PAP_CROPID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("pap_cropid")));

                if (!dr.IsDBNull(dr.GetOrdinal("cropname")))
                {
                    Cropsobj.Cropname = dr.GetString(dr.GetOrdinal("cropname"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("croptype")))
                {
                    Cropsobj.Croptype = dr.GetString(dr.GetOrdinal("croptype"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("cropdescription")))
                {
                    Cropsobj.Cropdescription = dr.GetString(dr.GetOrdinal("cropdescription"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("unitname")))
                {
                    Cropsobj.UnitName = dr.GetString(dr.GetOrdinal("unitname"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("quantity")))
                {
                    Cropsobj.QUANTITY = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("quantity")));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("croprate")))
                {
                    Cropsobj.CROPRATE = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("croprate")));
                }

                Listobj.Add(Cropsobj);
            }

            dr.Close();

            return(Listobj);
        }
コード例 #3
0
        /// <summary>
        /// To update data to database
        /// </summary>
        /// <param name="Cropsobj"></param>
        /// <returns></returns>
        public int Update(CropsBO Cropsobj)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);

            cnn.Open();
            OracleCommand dcmd = new OracleCommand("USP_TRN_UPD_CROPS", cnn);

            dcmd.CommandType = CommandType.StoredProcedure;
            int count = Convert.ToInt32(dcmd.CommandType);

            try
            {
                dcmd.Parameters.Add("HHID_", Cropsobj.HHID);
                dcmd.Parameters.Add("c_PAP_CROPID", Cropsobj.PAP_CROPID);
                dcmd.Parameters.Add("c_CROPID", Cropsobj.CROPID);
                dcmd.Parameters.Add("c_CROPTYPEID", Cropsobj.CROPTYPEID);
                dcmd.Parameters.Add("c_CROPDESCRIPTIONID", Cropsobj.CROPDESCRIPTIONID);
                dcmd.Parameters.Add("c_UNITOFMEASURE", DBNull.Value);
                dcmd.Parameters.Add("c_QUANTITY", Cropsobj.QUANTITY);
                dcmd.Parameters.Add("c_CROPRATE", Cropsobj.CROPRATE);

                if (Cropsobj.COMMENTS.Length > 1500)
                {
                    dcmd.Parameters.Add("c_COMMENTS", Cropsobj.COMMENTS.Substring(0, 1500));
                }
                else
                {
                    dcmd.Parameters.Add("c_COMMENTS", Cropsobj.COMMENTS);
                }

                dcmd.Parameters.Add("c_UPDATEDBY", Cropsobj.CREATEDBY);

                if (Cropsobj.Photo != null)
                {
                    dcmd.Parameters.Add("CROPPHOTO_", OracleDbType.Blob).Value = Cropsobj.Photo;
                }
                else
                {
                    dcmd.Parameters.Add("CROPPHOTO_", Oracle.DataAccess.Types.OracleBlob.Null);
                }

                return(dcmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dcmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
        }
コード例 #4
0
        /// <summary>
        /// To Update Data
        /// </summary>
        /// <param name="Cropsobj"></param>
        /// <returns></returns>
        public int UpdateData(CropsBO Cropsobj)
        {
            CropsDAL DALobj = new CropsDAL();

            try
            {
                return(DALobj.Update(Cropsobj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DALobj = null;
            }
        }
コード例 #5
0
        /// <summary>
        /// To Insert into Database
        /// </summary>
        /// <param name="Cropsobj"></param>
        /// <returns></returns>
        public int Insert(CropsBO Cropsobj)
        {
            CropsDAL DALobj = new CropsDAL(); //Data pass -to Database Layer

            try
            {
                return(DALobj.Insert(Cropsobj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DALobj = null;
            }
        }
コード例 #6
0
ファイル: Crops.aspx.cs プロジェクト: abigabaw/wis
        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;
        }
コード例 #7
0
ファイル: ShowImage.ashx.cs プロジェクト: abigabaw/wis
 public System.IO.MemoryStream ShowPAPCROPImage(int householdID, int PermanentStructureID)
 {
     try
     {
         CropsBO objDAMAGEDCROPSImage = (new CropsBLL()).ShowPAPCROPImage(householdID, PermanentStructureID);
         if (objDAMAGEDCROPSImage.Photo != null)
         {
             return(new System.IO.MemoryStream(objDAMAGEDCROPSImage.Photo));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         //throw ex;
         return(null);
     }
 }
コード例 #8
0
        /// <summary>
        /// To fetch details
        /// </summary>
        /// <param name="CropId"></param>
        /// <returns></returns>
        public CropsBO GetData(int CropId)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_TRN_GET_CROPS";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("c_pap_cropid", CropId);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader dr       = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            CropsBO          Cropsobj = null;
            CropsList        Listobj  = new CropsList();

            Cropsobj = new CropsBO();
            while (dr.Read())
            {
                if (!dr.IsDBNull(dr.GetOrdinal("pap_cropid")))
                {
                    Cropsobj.PAP_CROPID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("pap_cropid")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("CROPID")))
                {
                    Cropsobj.CROPID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CROPID")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("CROPTYPEID")))
                {
                    Cropsobj.CROPTYPEID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CROPTYPEID")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("CROPDESCRIPTIONID")))
                {
                    Cropsobj.CROPDESCRIPTIONID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CROPDESCRIPTIONID")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("UNITOFMEASURE")))
                {
                    Cropsobj.UNITOFMEASURE = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("UNITOFMEASURE")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("QUANTITY")))
                {
                    Cropsobj.QUANTITY = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("QUANTITY")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("CROPRATE")))
                {
                    Cropsobj.CROPRATE = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("CROPRATE")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("COMMENTS")))
                {
                    Cropsobj.COMMENTS = dr.GetString(dr.GetOrdinal("COMMENTS"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                {
                    Cropsobj.ISDELETED = dr.GetString(dr.GetOrdinal("ISDELETED"));
                }
            }
            dr.Close();

            return(Cropsobj);
        }
コード例 #9
0
ファイル: Crops.aspx.cs プロジェクト: abigabaw/wis
        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();
        }