Example #1
0
 protected void GridReport_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int DeleteId = 0;
         int CurRow   = Convert.ToInt32(e.RowIndex);
         DeleteId            = Convert.ToInt32(GridReport.Rows[CurRow].Cells[7].Text);
         ViewState["EditID"] = DeleteId;
         if (DeleteId != 0)
         {
             Entity_DailyInwardOutwardRegister.DailyOutRegisterId = DeleteId;
             Entity_DailyInwardOutwardRegister.UserId             = Convert.ToInt32(Session["UserID"]);
             Entity_DailyInwardOutwardRegister.LoginDate          = DateTime.Now;
             int iDelete = Obj_DailyInwardOutwardRegister.DeleteDailyInwardOutwardRegister(ref Entity_DailyInwardOutwardRegister, out StrError);
             if (iDelete != 0)
             {
                 Obj_Comm.ShowPopUpMsg("Record Succesfully Deleted", this.Page);
                 MakeEmptyForm();
             }
         }
         Entity_DailyInwardOutwardRegister = null;
         Obj_DailyInwardOutwardRegister    = null;
     }
     catch (Exception ex)
     {
     }
 }
Example #2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0, InsertRowDetails = 0;

        try
        {
            if (true == true)
            {
                Entity_DailyInwardOutwardRegister.InwardNo   = lblDInwardNo.Text;
                Entity_DailyInwardOutwardRegister.InwardDate = !string.IsNullOrEmpty(TxtDate.Text) ? Convert.ToDateTime(TxtDate.Text.Trim()) : DateTime.Now;
                Entity_DailyInwardOutwardRegister.EmployeeId = Convert.ToInt32(Session["UserId"]);//Convert.ToString(ddlIssueTo.SelectedValue);
                Entity_DailyInwardOutwardRegister.UserId     = Convert.ToInt32(Session["UserId"]);
                Entity_DailyInwardOutwardRegister.LoginDate  = DateTime.Now;
                InsertRow = Obj_DailyInwardOutwardRegister.InsertDailyInwardOutwardRegister(ref Entity_DailyInwardOutwardRegister, out StrError);

                if (InsertRow > 0)
                {
                    if (ViewState["CurrentTable"] != null)
                    {
                        for (int i = 0; i < GridDetails.Rows.Count; i++)
                        {
                            if (Convert.ToInt32(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text) > 0)
                            {
                                Entity_DailyInwardOutwardRegister.DailyOutRegisterId = InsertRow;//nazeria  1200000
                                Entity_DailyInwardOutwardRegister.ItemId             = Convert.ToInt32(GridDetails.Rows[i].Cells[0].Text);
                                Entity_DailyInwardOutwardRegister.Quantity           = Convert.ToDecimal(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text);
                                InsertRowDetails = Obj_DailyInwardOutwardRegister.InsertDailyInwardOutwardRegisterDetails(ref Entity_DailyInwardOutwardRegister, out StrError);
                            }
                        }
                    }

                    if (InsertRow > 0)
                    {
                        Obj_Comm.ShowPopUpMsg("Record Saved Successfully...!", this.Page);
                        MakeEmptyForm();
                        ddlCategory.SelectedValue         = ddlItem.SelectedValue = "0";
                        Entity_DailyInwardOutwardRegister = null;
                        Obj_DailyInwardOutwardRegister    = null;
                    }
                }
            }
            else
            {
                Obj_Comm.ShowPopUpMsg("Please Enter Details...!", this.Page);
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Example #3
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0, UpdateRowDtls = 0;

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_DailyInwardOutwardRegister.DailyOutRegisterId = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_DailyInwardOutwardRegister.InwardNo   = lblDInwardNo.Text;
            Entity_DailyInwardOutwardRegister.InwardDate = !string.IsNullOrEmpty(TxtDate.Text) ? Convert.ToDateTime(TxtDate.Text.Trim()) : DateTime.Now;
            Entity_DailyInwardOutwardRegister.EmployeeId = Convert.ToInt32(Session["UserId"]);//Convert.ToString(ddlIssueTo.SelectedValue);
            Entity_DailyInwardOutwardRegister.UserId     = Convert.ToInt32(Session["UserId"]);
            Entity_DailyInwardOutwardRegister.LoginDate  = DateTime.Now;
            UpdateRow = Obj_DailyInwardOutwardRegister.UpdateDailyInwardOutwardRegister(ref Entity_DailyInwardOutwardRegister, out StrError);
            if (UpdateRow > 0)
            {
                if (true == true)
                {
                    if (ViewState["CurrentTable"] != null)
                    {
                        DataTable dtInsert = new DataTable();
                        dtInsert = (DataTable)ViewState["CurrentTable"];

                        for (int i = 0; i < GridDetails.Rows.Count; i++)
                        {
                            Entity_DailyInwardOutwardRegister.DailyOutRegisterId = Convert.ToInt32(ViewState["EditID"]);
                            Entity_DailyInwardOutwardRegister.ItemId             = Convert.ToInt32(GridDetails.Rows[i].Cells[0].Text);
                            Entity_DailyInwardOutwardRegister.Quantity           = Convert.ToDecimal(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text);
                            UpdateRowDtls = Obj_DailyInwardOutwardRegister.InsertDailyInwardOutwardRegisterDetails(ref Entity_DailyInwardOutwardRegister, out StrError);
                        }
                    }
                    if (UpdateRow > 0)
                    {
                        Obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                        //MakeControlEmpty();
                        MakeEmptyForm();
                        Entity_DailyInwardOutwardRegister = null;
                        Obj_DailyInwardOutwardRegister    = null;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
        public int UpdateDailyInwardOutwardRegister(ref DailyInwardOutwardRegister Entity_Call, out string StrError)
        {
            int iInsert = 0;

            StrError = string.Empty;

            try
            {
                SqlParameter pAction             = new SqlParameter(DailyInwardOutwardRegister._Action, SqlDbType.BigInt);
                SqlParameter pDailyOutRegisterId = new SqlParameter(DailyInwardOutwardRegister._DailyOutRegisterId, SqlDbType.BigInt);
                SqlParameter pInwardNo           = new SqlParameter(DailyInwardOutwardRegister._InwardNo, SqlDbType.NVarChar);
                SqlParameter pInwardDate         = new SqlParameter(DailyInwardOutwardRegister._InwardDate, SqlDbType.DateTime);
                SqlParameter pEmployeeId         = new SqlParameter(DailyInwardOutwardRegister._EmployeeId, SqlDbType.BigInt);
                SqlParameter pUpdatedBy          = new SqlParameter(DailyInwardOutwardRegister._UserId, SqlDbType.BigInt);
                SqlParameter pUpdatedDate        = new SqlParameter(DailyInwardOutwardRegister._LoginDate, SqlDbType.DateTime);
                pAction.Value             = 2;
                pDailyOutRegisterId.Value = Entity_Call.DailyOutRegisterId;
                pInwardNo.Value           = Entity_Call.InwardNo;
                pInwardDate.Value         = Entity_Call.InwardDate;
                pEmployeeId.Value         = Entity_Call.EmployeeId;
                pUpdatedBy.Value          = Entity_Call.UserId;
                pUpdatedDate.Value        = Entity_Call.LoginDate;
                SqlParameter[] param = new SqlParameter[] { pAction, pDailyOutRegisterId, pInwardNo, pInwardDate, pEmployeeId, pUpdatedBy, pUpdatedDate };
                Open(CONNECTION_STRING);
                BeginTransaction();
                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, DailyInwardOutwardRegister.SP_DailyInwardOutwardRegister, param);
                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                throw new Exception(ex.Message);
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
        public int InsertDailyInwardOutwardRegisterDetails(ref DailyInwardOutwardRegister Entity_Call, out string StrError)
        {
            StrError = string.Empty;
            int iInsert = 0;

            try
            {
                SqlParameter pAction             = new SqlParameter(DailyInwardOutwardRegister._Action, SqlDbType.BigInt);
                SqlParameter pDailyOutRegisterId = new SqlParameter(DailyInwardOutwardRegister._DailyOutRegisterId, SqlDbType.BigInt);
                SqlParameter pItemId             = new SqlParameter(DailyInwardOutwardRegister._ItemId, SqlDbType.BigInt);
                SqlParameter pQuantity           = new SqlParameter(DailyInwardOutwardRegister._Quantity, SqlDbType.Decimal);
                pAction.Value             = 8;
                pDailyOutRegisterId.Value = Entity_Call.DailyOutRegisterId;
                pItemId.Value             = Entity_Call.ItemId;
                pQuantity.Value           = Entity_Call.Quantity;
                SqlParameter[] param = new SqlParameter[] { pAction, pDailyOutRegisterId, pItemId, pQuantity };
                Open(CONNECTION_STRING);
                BeginTransaction();
                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, DailyInwardOutwardRegister.SP_DailyInwardOutwardRegister, param);
                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                throw new Exception(ex.Message);
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }