Example #1
0
        private void LoadData(Guid Id)
        {
            RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();

            obj = obj.GetById(Id);
            if (obj != null)
            {
                if (obj.Id != null)
                {
                    hfGRNID.Value = obj.Id.ToString();
                }
                if (obj.GRN_Number != null)
                {
                    this.txtGRNNo.Text = obj.GRN_Number;
                }
                if (obj.DateRequested != null)
                {
                    this.txtDateRequested.Text = obj.DateRequested.ToString();
                }
                if (obj.Remark != null)
                {
                    this.txtRemark.Text = obj.Remark;
                }
                hfTrackingNo.Value = obj.TrackingNo;

                this.cboStatus.SelectedValue = ((int)obj.Status).ToString();
            }
        }
Example #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();

            obj.Id            = new Guid(this.hfGRNID.Value.ToString());
            obj.DateRequested = DateTime.Parse(this.txtDateRequested.Text);
            obj.Remark        = this.txtRemark.Text;
            obj.Status        = (RequestforApprovedGRNCancelationStatus)int.Parse((this.cboStatus.SelectedValue.ToString()));
            try
            {
                if (obj.Update() == true)
                {
                    this.lblMessage.Text = "Update sucessfull.";
                    return;
                }
                else
                {
                    this.lblMessage.Text = "Unable to Update Data.";
                    return;
                }
            }
            catch
            {
                this.lblMessage.Text = " An Error has occured please try again";
                return;
            }
        }
Example #3
0
        public bool CancelGRNCancellationRequest(string TrackingNo)
        {
            bool isSaved = false;

            Utility.LogException(new Exception(TrackingNo));
            RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();

            isSaved = obj.CancelGRNCancellationRequest(TrackingNo);
            return(isSaved);
        }
Example #4
0
        public static bool save(SqlTransaction tran, RequestforApprovedGRNCancelationBLL obj)
        {
            try
            {
                int AffectedRows = 0;

                string         strSql = "spInsertRequestApprovedGRNCancelation";
                SqlParameter[] arPar  = new SqlParameter[8];

                arPar[0]       = new SqlParameter("@GRNId", SqlDbType.UniqueIdentifier);
                arPar[0].Value = obj.GRNId;

                arPar[1]       = new SqlParameter("@RequestedBy", SqlDbType.UniqueIdentifier);
                arPar[1].Value = obj.RequestedBy;

                arPar[2]       = new SqlParameter("@DateRequested", SqlDbType.DateTime);
                arPar[2].Value = obj.DateRequested;

                arPar[3]       = new SqlParameter("@Remark", SqlDbType.Text);
                arPar[3].Value = obj.Remark;

                arPar[4]       = new SqlParameter("@Status", SqlDbType.Int);
                arPar[4].Value = (int)obj.Status;

                arPar[5]       = new SqlParameter("@TrackingNo", SqlDbType.NVarChar, 50);
                arPar[5].Value = obj.TrackingNo;

                arPar[6]       = new SqlParameter("@CreatedBy", SqlDbType.UniqueIdentifier);
                arPar[6].Value = UserBLL.GetCurrentUser();

                arPar[7]       = new SqlParameter("@Id", SqlDbType.UniqueIdentifier);
                arPar[7].Value = obj.Id;

                AffectedRows = SqlHelper.ExecuteNonQuery(tran, strSql, arPar);
                if (AffectedRows == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Insert Data ", ex);
            }
        }
Example #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            bool isSaved = false;
            RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();

            obj.GRNId         = new Guid(this.hfGRNID.Value.ToString());
            obj.RequestedBy   = UserBLL.GetCurrentUser();
            obj.DateRequested = DateTime.Parse(this.txtDateRequested.Text);
            obj.Remark        = this.txtRemark.Text;
            obj.Status        = RequestforApprovedGRNCancelationStatus.New;
            isSaved           = obj.Add();
            if (isSaved == true)
            {
                this.lblMessage.Text = "Data Added Successfully.";
                this.btnAdd.Enabled  = false;
            }
            else
            {
                this.lblMessage.Text = "Data Can't be Added.please check the data and try again";
                return;
            }
        }
Example #6
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (list != null)
            {
                list.Clear();
            }

            string GRNNo             = string.Empty;
            string TrackingNo        = string.Empty;
            Nullable <DateTime> from = null;
            Nullable <DateTime> to   = null;
            Nullable <RequestforEditGRNStatus> status = null;

            GRNNo      = this.txtGRN.Text;
            TrackingNo = this.txtTrackingNo.Text;
            try
            {
                status = (RequestforEditGRNStatus)int.Parse(this.cboStatus.SelectedValue);
            }
            catch
            {
                status = null;
            }
            try
            {
                from = DateTime.Parse(this.txtFrom.Text);
            }
            catch
            {
                from = null;
            }
            try
            {
                to = DateTime.Parse(this.txtTo.Text);
            }
            catch
            {
                to = null;
            }
            RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();

            try
            {
                list = obj.Search(GRNNo, TrackingNo, status, from, to);
                if (list != null)
                {
                    if (list.Count <= 0)
                    {
                        this.lblMessage.Text             = "No recoreds Found";
                        this.gvGRNEditRequest.DataSource = list;
                        this.gvGRNEditRequest.DataBind();
                        return;
                    }
                    else
                    {
                        this.gvGRNEditRequest.DataSource = list;
                        this.gvGRNEditRequest.DataBind();
                    }
                }
                else
                {
                    this.lblMessage.Text             = "No recoreds Found";
                    this.gvGRNEditRequest.DataSource = list;
                    this.gvGRNEditRequest.DataBind();
                    return;
                }
            }
            catch (Exception ex)
            {
                this.lblMessage.Text = ex.Message;
            }
        }
Example #7
0
        public static RequestforApprovedGRNCancelationBLL GetByTrackingNo(string TrackingNo)
        {
            string        strSql = "spGetRequestApprovedGRNCancelationByTrackingNo";
            SqlDataReader reader = null;

            SqlParameter[] arPar = new SqlParameter[1];
            arPar[0]       = new SqlParameter("@TrackingNo", SqlDbType.VarChar, 50);
            arPar[0].Value = TrackingNo;
            SqlConnection conn = null;

            try
            {
                conn   = Connection.getConnection();
                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();
                        if (reader["Id"] != DBNull.Value)
                        {
                            obj.Id = new Guid(reader["Id"].ToString());
                        }
                        if (reader["GRNId"] != DBNull.Value)
                        {
                            obj.GRNId = new Guid(reader["GRNId"].ToString());
                        }
                        if (reader["RequestedBy"] != DBNull.Value)
                        {
                            obj.RequestedBy = new Guid(reader["RequestedBy"].ToString());
                        }
                        if (reader["DateRequested"] != DBNull.Value)
                        {
                            obj.DateRequested = DateTime.Parse((reader["DateRequested"].ToString()));
                        }
                        obj.Remark = reader["Remark"].ToString();
                        if (reader["Status"] != DBNull.Value)
                        {
                            obj.Status = (RequestforApprovedGRNCancelationStatus)(int.Parse(reader["Status"].ToString()));
                        }
                        obj.TrackingNo = reader["Remark"].ToString();


                        if (reader["TrackingNo"] != DBNull.Value)
                        {
                            obj.TrackingNo = reader["TrackingNo"].ToString();
                        }
                        if (reader["GRN_Number"] != DBNull.Value)
                        {
                            obj.GRN_Number = reader["GRN_Number"].ToString();
                        }

                        return(obj);
                    }
                    return(null);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
Example #8
0
        private static List <RequestforApprovedGRNCancelationBLL> SearchHelper(string strSql)
        {
            List <RequestforApprovedGRNCancelationBLL> list;
            SqlDataReader reader;
            SqlConnection conn = Connection.getConnection();

            if (conn == null || conn.State != ConnectionState.Open)
            {
                throw new Exception("Invalid database connection.");
            }
            reader = SqlHelper.ExecuteReader(conn, CommandType.Text, strSql);
            if (reader.HasRows)
            {
                list = new List <RequestforApprovedGRNCancelationBLL>();
                while (reader.Read())
                {
                    RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();
                    if (reader["Id"] != DBNull.Value)
                    {
                        obj.Id = new Guid(reader["Id"].ToString());
                    }
                    if (reader["GRNId"] != DBNull.Value)
                    {
                        obj.GRNId = new Guid(reader["GRNId"].ToString());
                    }
                    if (reader["RequestedBy"] != DBNull.Value)
                    {
                        obj.RequestedBy = new Guid(reader["RequestedBy"].ToString());
                    }
                    if (reader["DateRequested"] != DBNull.Value)
                    {
                        obj.DateRequested = DateTime.Parse((reader["DateRequested"].ToString()));
                    }
                    obj.Remark = reader["Remark"].ToString();
                    if (reader["Status"] != DBNull.Value)
                    {
                        obj.Status = (RequestforApprovedGRNCancelationStatus)(int.Parse(reader["Status"].ToString()));
                    }
                    obj.TrackingNo = reader["Remark"].ToString();


                    if (reader["TrackingNo"] != DBNull.Value)
                    {
                        obj.TrackingNo = reader["TrackingNo"].ToString();
                    }
                    if (reader["GRN_Number"] != DBNull.Value)
                    {
                        obj.GRN_Number = reader["GRN_Number"].ToString();
                    }

                    list.Add(obj);
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                return(list);
            }
            else
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                return(null);
            }
        }