예제 #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)
     {
     }
 }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #4
0
 private void ReportGrid(string RepCondition)
 {
     try
     {
         DS = Obj_DailyInwardOutwardRegister.GetDailyInwardOutward(StrCondition, out StrError);
         if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
         {
             //GridReport.DataSource = DS.Tables[0];
             //GridReport.DataBind();
         }
         else
         {
             GridReport.DataSource = null;
             GridReport.DataBind();
         }
         Obj_DailyInwardOutwardRegister = null;
         DS = null;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }