Beispiel #1
0
        public Result SaveMSTPurchaseBill(ERPDTOBase obj)
        {
            MSTPurchaseBillDTO oMSTPurchaseBillDTO = obj as MSTPurchaseBillDTO;

            return(new PurchaseBillDAL().SaveMSTPurchaseBill(oMSTPurchaseBillDTO));
        }
Beispiel #2
0
        //public int MSTSaleOrderReceivingEntryId { get; set; }

        public Result SaveMSTPurchaseBill(MSTPurchaseBillDTO oMSTPurchaseBillDTO)
        {
            try
            {
                // DataSet ds = SqlHelper.ExecuteDataset(trans, CommandType.StoredProcedure, "InsertUpdatePreShipmentMaster", sqlParameter);
                using (DbCommand cmd = Common.dbConn.GetStoredProcCommand("MSTPurchaseBillSave"))
                {
                    Common.dbConn.AddInParameter(cmd, "@Id", DbType.Int32, oMSTPurchaseBillDTO.Id);
                    Common.dbConn.AddInParameter(cmd, "@SerialBillNo", DbType.String, oMSTPurchaseBillDTO.SerialBillNo);
                    Common.dbConn.AddInParameter(cmd, "@BillNo", DbType.String, oMSTPurchaseBillDTO.BillNo);
                    Common.dbConn.AddInParameter(cmd, "@Supplier", DbType.Int32, oMSTPurchaseBillDTO.Supplier);
                    Common.dbConn.AddInParameter(cmd, "@Narration", DbType.String, oMSTPurchaseBillDTO.Narration);

                    if (oMSTPurchaseBillDTO.Entrydate == DateTime.MinValue)
                    {
                        Common.dbConn.AddInParameter(cmd, "@Entrydate", DbType.Date, System.DBNull.Value);
                    }
                    else
                    {
                        Common.dbConn.AddInParameter(cmd, "@Entrydate", DbType.Date, oMSTPurchaseBillDTO.Entrydate.ToString("dd/MM/yyyy"));
                    }

                    if (oMSTPurchaseBillDTO.BillDate == DateTime.MinValue)
                    {
                        Common.dbConn.AddInParameter(cmd, "@BillDate", DbType.Date, System.DBNull.Value);
                    }
                    else
                    {
                        Common.dbConn.AddInParameter(cmd, "@BillDate", DbType.Date, oMSTPurchaseBillDTO.BillDate.Date.ToString("dd/MM/yyyy"));
                    }
                    Common.dbConn.AddInParameter(cmd, "@PurchaseCategy", DbType.Int32, oMSTPurchaseBillDTO.PurchaseCategy);
                    Common.dbConn.AddInParameter(cmd, "@PurchaseType", DbType.Int32, oMSTPurchaseBillDTO.PurchaseType);
                    Common.dbConn.AddInParameter(cmd, "@AccountGroupMasId", DbType.Int32, oMSTPurchaseBillDTO.PurchaseAcc);
                    Common.dbConn.AddInParameter(cmd, "@ExciseDuty", DbType.Double, oMSTPurchaseBillDTO.ExciseDuty);
                    Common.dbConn.AddInParameter(cmd, "@Cess", DbType.Double, oMSTPurchaseBillDTO.Cess);
                    Common.dbConn.AddInParameter(cmd, "@HECess", DbType.Double, oMSTPurchaseBillDTO.HECess);
                    Common.dbConn.AddInParameter(cmd, "@AddExcise", DbType.Boolean, oMSTPurchaseBillDTO.AddExcise);
                    Common.dbConn.AddInParameter(cmd, "@ExciseReg", DbType.Double, oMSTPurchaseBillDTO.ExciseReg);
                    Common.dbConn.AddInParameter(cmd, "@ExciseNo", DbType.Double, oMSTPurchaseBillDTO.ExciseNo);
                    Common.dbConn.AddInParameter(cmd, "@Transport", DbType.String, oMSTPurchaseBillDTO.Transport);
                    Common.dbConn.AddInParameter(cmd, "@Carrier", DbType.String, oMSTPurchaseBillDTO.Carrier);
                    Common.dbConn.AddInParameter(cmd, "@Remarks", DbType.String, oMSTPurchaseBillDTO.Remarks);
                    Common.dbConn.AddInParameter(cmd, "@TotalAmount", DbType.Double, oMSTPurchaseBillDTO.TotalAmount);
                    Common.dbConn.AddInParameter(cmd, "@SaleTax", DbType.Double, oMSTPurchaseBillDTO.SaleTax);
                    Common.dbConn.AddInParameter(cmd, "@SurchargeTax", DbType.Double, oMSTPurchaseBillDTO.SurchargeTax);
                    Common.dbConn.AddInParameter(cmd, "@BillAmount", DbType.Double, oMSTPurchaseBillDTO.BillAmount);
                    Common.dbConn.AddInParameter(cmd, "@MakeIssueToProductionBill", DbType.Boolean, oMSTPurchaseBillDTO.MakeIssueToProductionBill);
                    Common.dbConn.AddInParameter(cmd, "@PackingForwarding", DbType.String, oMSTPurchaseBillDTO.PackingForwarding);
                    Common.dbConn.AddInParameter(cmd, "@friegthInsurance", DbType.String, oMSTPurchaseBillDTO.Freightnsurance);
                    Common.dbConn.AddInParameter(cmd, "@Type", DbType.Int16, oMSTPurchaseBillDTO.Type);

                    DataSet dsResult = Common.dbConn.ExecuteDataSet(cmd);

                    Result res = new Result {
                        Id = ((dsResult.Tables[0].Rows[0]["Result"])).ToInt(), ResultStatus = OperationStatus.SavedSuccessFully
                    };
                    //res.Message = GetSno(res.Id);
                    res.Message = res.Id.ToString();

                    using (DbCommand cmdUpdateSno = Common.dbConn.GetStoredProcCommand("UpdatePurchaseBillSno"))
                    {
                        Common.dbConn.AddInParameter(cmdUpdateSno, "@PurchaseBillId", DbType.Int32, res.Id);
                        Common.dbConn.AddInParameter(cmdUpdateSno, "@SerialBillNo", DbType.String, res.Message);
                        Common.dbConn.ExecuteNonQuery(cmdUpdateSno);
                    }

                    return(res);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }