Exemplo n.º 1
0
        private long SaveConsumptionMaster(ConsumptionMaster _objConsumptonMaster)
        {
            Int64 NextId = 0;

            GenericFactory_EFRndConsumptionMaster = new RndConsumptionMaster_EF();
            try
            {
                NextId = Convert.ToInt64(GenericFactory_EFRndConsumptionMaster.getMaxID("RndConsumptionMaster"));
                RndConsumptionMaster _objConsumptionMaster = new RndConsumptionMaster();
                _objConsumptionMaster.ConsumptionID = NextId;
                _objConsumptionMaster.Description   = _objConsumptonMaster.Description;
                _objConsumptionMaster.Note          = _objConsumptonMaster.Note;
                _objConsumptionMaster.ItemID        = _objConsumptonMaster.ItemID;
                _objConsumptionMaster.CompanyID     = _objConsumptonMaster.CompanyID;
                _objConsumptionMaster.IsDeleted     = false;
                _objConsumptionMaster.CreateBy      = _objConsumptonMaster.CreateBy;
                _objConsumptionMaster.CreateOn      = DateTime.Today;
                _objConsumptionMaster.CreatePc      = HostService.GetIP();
                GenericFactory_EFRndConsumptionMaster.Insert(_objConsumptionMaster);
                GenericFactory_EFRndConsumptionMaster.Save();
                GenericFactory_EFRndConsumptionMaster.updateMaxID("RndConsumptionMaster", NextId + 1);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            return(NextId);
        }
Exemplo n.º 2
0
    protected void ReportGrid1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int DeleteId = 0;

        try
        {
            DeleteId = Convert.ToInt32(((ImageButton)ReportGrid1.Rows[e.RowIndex].Cells[0].FindControl("ImgBtnDelete")).CommandArgument.ToString());
            if (DeleteId != 0)
            {
                Entity_ConsumeMaster.ConsumptionId = DeleteId;
                Entity_ConsumeMaster.UserId        = Convert.ToInt32(Session["UserID"]);
                Entity_ConsumeMaster.LoginDate     = DateTime.Now;

                int iDelete = Obj_ConsumeMaster.DeleteRecord(ref Entity_ConsumeMaster, out StrError);
                if (iDelete != 0)
                {
                    obj_Comman.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                    MakeEmptyForm();
                }
            }

            Entity_ConsumeMaster = null;
            Obj_ConsumeMaster    = null;
        }
        catch (Exception ex)
        {
        }
    }
Exemplo n.º 3
0
        public int InsertRecord(ref ConsumptionMaster Entity_StockMaster, int LOCID, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction          = new SqlParameter(ConsumptionMaster._Action, SqlDbType.BigInt);
                SqlParameter pStockNo         = new SqlParameter(ConsumptionMaster._ConsumptionNo, SqlDbType.NVarChar);
                SqlParameter pStockDate       = new SqlParameter(ConsumptionMaster._ConsumptionAsOn, SqlDbType.DateTime);
                SqlParameter pConsumptionDate = new SqlParameter(ConsumptionMaster._ConsumptionDate, SqlDbType.DateTime);
                SqlParameter pIssueId         = new SqlParameter("@IssueId", SqlDbType.BigInt);
                SqlParameter pCreatedBy       = new SqlParameter(ConsumptionMaster._UserId, SqlDbType.BigInt);
                SqlParameter pCreatedDate     = new SqlParameter(ConsumptionMaster._LoginDate, SqlDbType.DateTime);
                SqlParameter pLOCID           = new SqlParameter("@LOCID", SqlDbType.BigInt);

                pAction.Value          = 5;
                pStockNo.Value         = Entity_StockMaster.ConsumptionNo;
                pStockDate.Value       = Entity_StockMaster.ConsumptionAsOn;
                pConsumptionDate.Value = Entity_StockMaster.ConsumptionAsOn;
                pIssueId.Value         = Entity_StockMaster.IssueId;
                pCreatedBy.Value       = Entity_StockMaster.UserId;
                pCreatedDate.Value     = Entity_StockMaster.LoginDate;
                pLOCID.Value           = LOCID;

                SqlParameter[] Param = new SqlParameter[] { pAction, pStockNo, pIssueId, pConsumptionDate, pStockDate, pCreatedBy, pCreatedDate, pLOCID };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteScalar(_Connection, _Transaction, CommandType.StoredProcedure, ConsumptionMaster.SP_CosumptionMaster, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
Exemplo n.º 4
0
        public int DeleteRecord(ref ConsumptionMaster Entity_StockMaster, out string strError)
        {
            int iDelete = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction    = new SqlParameter(ConsumptionMaster._Action, SqlDbType.BigInt);
                SqlParameter pOutwardId = new SqlParameter(ConsumptionMaster._ConsumptionId, SqlDbType.BigInt);

                SqlParameter pDeletedBy   = new SqlParameter(ConsumptionMaster._UserId, SqlDbType.BigInt);
                SqlParameter pDeletedDate = new SqlParameter(ConsumptionMaster._LoginDate, SqlDbType.DateTime);

                pAction.Value    = 9;
                pOutwardId.Value = Entity_StockMaster.ConsumptionId;

                pDeletedBy.Value   = Entity_StockMaster.UserId;
                pDeletedDate.Value = Entity_StockMaster.LoginDate;


                SqlParameter[] Param = new SqlParameter[] { pAction, pOutwardId, pDeletedBy, pDeletedDate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, ConsumptionMaster.SP_CosumptionMaster, Param);

                if (iDelete > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iDelete);
        }
        public int SaveConsumpiton(object[] data)
        {
            int result = 0;
            List <vmConsumption> _objvmConsumptions   = JsonConvert.DeserializeObject <List <vmConsumption> >(data[0].ToString());
            ConsumptionMaster    _objConsumptonMaster = JsonConvert.DeserializeObject <ConsumptionMaster>(data[1].ToString());

            try
            {
                result = _objFinishGood.SaveConsumpiton(_objvmConsumptions, _objConsumptonMaster);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
Exemplo n.º 6
0
        public int SaveConsumpiton(List <vmConsumption> _objvmConsumptions, ConsumptionMaster _objConsumptonMaster)
        {
            int result = 0;

            using (TransactionScope transaction = new TransactionScope())
            {
                GenericFactory_EFRndConsumptionMaster = new RndConsumptionMaster_EF();
                GenericFactory_EFRndConsumptionDetail = new RndConsumptionDetail_EF();
                List <RndConsumptionDetail> listDetails = GenericFactory_EFRndConsumptionDetail.FindBy(x => x.ItemID == _objConsumptonMaster.ItemID).ToList();
                List <RndConsumptionMaster> listMaster  = GenericFactory_EFRndConsumptionMaster.FindBy(x => x.ItemID == _objConsumptonMaster.ItemID).ToList();
                GenericFactory_EFRndConsumptionDetail.DeleteList(listDetails);
                GenericFactory_EFRndConsumptionDetail.Save();
                GenericFactory_EFRndConsumptionMaster.DeleteList(listMaster);
                GenericFactory_EFRndConsumptionMaster.Save();

                Int64 ConsumptionId = SaveConsumptionMaster(_objConsumptonMaster);
                SaveConsumptionDetails(_objvmConsumptions, ConsumptionId, _objConsumptonMaster.CompanyID, _objConsumptonMaster.CreateBy);
                transaction.Complete();
            }
            return(result);
        }
Exemplo n.º 7
0
        public int UpdateAssignFlag(ref ConsumptionMaster Entity_StockMaster, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction   = new SqlParameter(ConsumptionMaster._Action, SqlDbType.BigInt);
                SqlParameter pInwardId = new SqlParameter(ConsumptionMaster._IssueId, SqlDbType.BigInt);


                pAction.Value   = 16;
                pInwardId.Value = Entity_StockMaster.IssueId;


                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQueryDoubleParm(_Connection, _Transaction, CommandType.StoredProcedure, ConsumptionMaster.SP_CosumptionMaster, pAction, pInwardId);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
Exemplo n.º 8
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int       InsertRow = 0, InsertRowDtls = 0;
        DataTable dtInsert = new DataTable();

        try
        {
            if (ChkGridRow())
            {
                Entity_ConsumeMaster.ConsumptionNo   = TxtConsumptionNo.Text;
                Entity_ConsumeMaster.ConsumptionAsOn = !string.IsNullOrEmpty(TxtDate.Text) ? Convert.ToDateTime(TxtDate.Text) : Convert.ToDateTime(DateTime.Now.ToShortDateString());
                Entity_ConsumeMaster.IssueId         = Convert.ToInt32(((Label)GridIssueDetails.Rows[0].FindControl("LblEntryId")).Text);
                Entity_ConsumeMaster.UserId          = Convert.ToInt32(Session["UserId"]);
                Entity_ConsumeMaster.LoginDate       = DateTime.Now;
                InsertRow = Obj_ConsumeMaster.InsertRecord(ref Entity_ConsumeMaster, Convert.ToInt32((Session["CafeteriaId"].ToString())), out StrError);
                if (InsertRow > 0)
                {
                    #region [issueWise]

                    if (ViewState["CurrentTable"] != null)
                    {
                        for (int i = 0; i < GridIssueDetails.Rows.Count; i++)
                        {
                            decimal Outwrd = (((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdConsumption")).Text).Equals("") ? 0 : Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdConsumption")).Text);
                            if (Outwrd > 0)
                            {
                                if (Outwrd != 0)
                                {
                                    Entity_ConsumeMaster.ConsumptionId = InsertRow;
                                    Entity_ConsumeMaster.IssueId       = Convert.ToInt32(((Label)GridIssueDetails.Rows[i].FindControl("LblEntryId")).Text);
                                    Entity_ConsumeMaster.ItemId        = Convert.ToInt32(GridIssueDetails.Rows[i].Cells[2].Text);

                                    Entity_ConsumeMaster.ItemDetailsId = Convert.ToInt32(GridIssueDetails.Rows[i].Cells[4].Text);
                                    Entity_ConsumeMaster.ItemDesc      = Convert.ToString(GridIssueDetails.Rows[i].Cells[5].Text);

                                    Entity_ConsumeMaster.IssueQty        = Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdIssue")).Text);
                                    Entity_ConsumeMaster.ConsumeQty      = Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdConsumption")).Text);
                                    Entity_ConsumeMaster.PendingQty      = Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdPending")).Text);
                                    Entity_ConsumeMaster.LocationId      = Convert.ToInt32(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdLocationID")).Text);
                                    Entity_ConsumeMaster.StockLocationID = Convert.ToInt32(Session["CafeteriaId"].ToString());
                                    Entity_ConsumeMaster.Rate            = Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdRate")).Text);
                                    Entity_ConsumeMaster.Amount          = Convert.ToDecimal(((TextBox)GridIssueDetails.Rows[i].FindControl("txtGrdConsumptionAmt")).Text);
                                    Entity_ConsumeMaster.LoginDate       = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                                    //InsertRowDtls = Obj_ConsumeMaster.InsertDetailsRecord(ref Entity_ConsumeMaster,Convert.ToInt32(GridIssueDetails.Rows[i].Cells[16].Text), out StrError);
                                    InsertRowDtls = Obj_ConsumeMaster.InsertDetailsRecord(ref Entity_ConsumeMaster, Convert.ToInt32(0), out StrError);
                                    if (Entity_ConsumeMaster.PendingQty > 0)
                                    {
                                        FlagPending = true;
                                        goto j;
                                    }
                                    else
                                    {
                                        FlagPending = false;
                                    }
                                }
                                else
                                {
                                    Entity_ConsumeMaster.ConsumptionId = InsertRow;
                                    Entity_ConsumeMaster.UserId        = Convert.ToInt32(Session["UserID"]);
                                    Entity_ConsumeMaster.LoginDate     = DateTime.Now;
                                    // int iDelete = Obj_ConsumeMaster.DeleteRecord(ref Entity_ConsumeMaster, out StrError);
                                }
                            }
                            string str;
                            j : str = string.Empty;
                        }
                        if (InsertRow > 0)
                        {
                            //int UpdateFlagInward = Obj_ConsumeMaster.UpdateAssignFlag(ref Entity_ConsumeMaster, out StrError);
                            obj_Comman.ShowPopUpMsg("Record Saved Successfully", this.Page);
                            FillCombo();
                            MakeControlEmpty();
                            MakeEmptyForm();
                            Entity_ConsumeMaster = null;
                            Obj_ConsumeMaster    = null;
                        }
                    }

                    #endregion
                }
            }
            else
            {
                obj_Comman.ShowPopUpMsg("No Record Found In Grid", this.Page);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Exemplo n.º 9
0
        public int InsertDetailsRecord(ref ConsumptionMaster Entity_StockMaster, int UNITID, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction = new SqlParameter(ConsumptionMaster._Action, SqlDbType.BigInt);

                SqlParameter pOutwardId = new SqlParameter(ConsumptionMaster._ConsumptionId, SqlDbType.BigInt);
                SqlParameter pInwardId  = new SqlParameter(ConsumptionMaster._IssueId, SqlDbType.BigInt);
                SqlParameter pItemId    = new SqlParameter(ConsumptionMaster._ItemId, SqlDbType.BigInt);

                SqlParameter pItemDetailsId = new SqlParameter(ConsumptionMaster._ItemDetailsId, SqlDbType.BigInt);
                SqlParameter pItemDesc      = new SqlParameter(ConsumptionMaster._ItemDesc, SqlDbType.NVarChar);

                SqlParameter pInwardQty       = new SqlParameter(ConsumptionMaster._IssueQty, SqlDbType.Decimal);
                SqlParameter pOutwardQty      = new SqlParameter(ConsumptionMaster._ConsumeQty, SqlDbType.Decimal);
                SqlParameter pPendingQty      = new SqlParameter(ConsumptionMaster._PendingQty, SqlDbType.Decimal);
                SqlParameter pLocationId      = new SqlParameter(ConsumptionMaster._LocationId, SqlDbType.BigInt);
                SqlParameter pStockLocationId = new SqlParameter(ConsumptionMaster._StockLocationId, SqlDbType.BigInt);
                SqlParameter pRate            = new SqlParameter("@Rate1", SqlDbType.Decimal);
                SqlParameter pAmount          = new SqlParameter(ConsumptionMaster._Amount, SqlDbType.Decimal);
                SqlParameter pCreatedDate     = new SqlParameter(PurchaseOrder._LoginDate, SqlDbType.DateTime);

                SqlParameter pUNITID = new SqlParameter("@UnitConversionId", SqlDbType.BigInt);

                pAction.Value    = 6;
                pOutwardId.Value = Entity_StockMaster.ConsumptionId;
                pInwardId.Value  = Entity_StockMaster.IssueId;
                pItemId.Value    = Entity_StockMaster.ItemId;

                pItemDetailsId.Value = Entity_StockMaster.ItemDetailsId;
                pItemDesc.Value      = Entity_StockMaster.ItemDesc;


                pInwardQty.Value       = Entity_StockMaster.IssueQty;
                pOutwardQty.Value      = Entity_StockMaster.ConsumeQty;
                pPendingQty.Value      = Entity_StockMaster.PendingQty;
                pLocationId.Value      = Entity_StockMaster.LocationId;
                pStockLocationId.Value = Entity_StockMaster.StockLocationID;
                pRate.Value            = Entity_StockMaster.Rate;
                pAmount.Value          = Entity_StockMaster.Amount;
                pCreatedDate.Value     = Entity_StockMaster.LoginDate;
                pUNITID.Value          = 0;
                //pUNITID.Value = UNITID;
                //pUNITID
                SqlParameter[] Param = new SqlParameter[] { pAction, pOutwardId, pItemId, pInwardId, pInwardQty, pOutwardQty, pPendingQty, pLocationId, pStockLocationId, pRate, pAmount, pCreatedDate, pUNITID, pItemDetailsId, pItemDesc };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, ConsumptionMaster.SP_CosumptionMaster, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }