Пример #1
0
        public DataTable GetCategory()
        {
            DataTable     dtCategory = new DataTable();
            SqlConnection conn       = SQLCon.Sqlconn();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_CATEGORY]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtCategory);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving Category List", ex);
            }
            finally
            {
                conn.Close();
            }
            return(dtCategory);
        }
Пример #2
0
 public void SavePOSConfiguration(object BranchID, object BranchCounterID, object DayClosureID, object BranchRefundID)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[POS_USP_C_POSDETAILS]";
             cmd.Parameters.AddWithValue("@BRANCHID", BranchID);
             cmd.Parameters.AddWithValue("@BRANCHCOUNTERID", BranchCounterID);
             cmd.Parameters.AddWithValue("@DayClosureID", DayClosureID);
             cmd.Parameters.AddWithValue("@BranchRefundID", BranchRefundID);
             int IValue = cmd.ExecuteNonQuery();
             if (IValue == 0)
             {
                 throw new Exception("Error While Saving POS Configuration");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         SQLCon.Sqlconn().Close();
     }
 }
        public DataSet GetDaySequence(object branchCounterID)
        {
            DataSet dsRestoreData = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlCloudconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_POS_IMPORTDATA]";
                    cmd.Parameters.AddWithValue("@BranchCounterID", branchCounterID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsRestoreData);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting restore data", ex);
            }
            finally
            {
                SQLCon.SqlCloudconn().Close();
            }

            return(dsRestoreData);
        }
        public void SaveData(string entityName, DataTable dtEntityWiseData)
        {
            if (dtEntityWiseData?.Rows.Count == 0 || !entityMapping.ContainsKey(entityName))
            {
                return;
            }

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlCloudconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    EntityMapping map = entityMapping[entityName];
                    cmd.CommandText = map.ProcedureName;
                    cmd.Parameters.AddWithValue(map.ParameterName, dtEntityWiseData);
                    if (map.IncludeBranchCounterID)
                    {
                        cmd.Parameters.AddWithValue("@BranchCounterID", Utility.branchinfo.BranchCounterID);
                    }
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While saving Entity wise data List", ex);
            }
            finally
            {
                SQLCon.SqlCloudconn().Close();
            }
        }
        public DataSet DraftBill(object userID, int daySequenceID, object billID)
        {
            DataSet dsNextBill = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_DRAFT_BILL]";
                    cmd.Parameters.AddWithValue("@UserID", userID);
                    cmd.Parameters.AddWithValue("@BillID", billID);
                    cmd.Parameters.AddWithValue("@DaySequenceID", daySequenceID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsNextBill);
                    }

                    dsNextBill.Tables[0].TableName = "BILL";
                    dsNextBill.Tables[1].TableName = "BILLDETAILS";
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While drafting and getting next bill", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dsNextBill);
        }
 public void ImportDaySequence(DataSet dsRestoreData)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "USP_CU_POS_IMPORTDATA";
             cmd.Parameters.AddWithValue("@Bill", dsRestoreData.Tables[0]);
             cmd.Parameters.AddWithValue("@BillDetail", dsRestoreData.Tables[1]);
             cmd.Parameters.AddWithValue("@BillMOPDetail", dsRestoreData.Tables[2]);
             cmd.Parameters.AddWithValue("@DaySequence", dsRestoreData.Tables[3]);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"Error While importing day sequence", ex);
     }
     finally
     {
         SQLCon.Sqlconn().Close();
     }
 }
Пример #7
0
        public DataTable GetOfferList(object ItemPriceID)
        {
            DataTable dtOffers = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_GETOFFERS]";
                    cmd.Parameters.AddWithValue("@ITEMPRICEID", ItemPriceID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtOffers);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving Offer List", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtOffers);
        }
Пример #8
0
 public void FinishBRefund(object BRefundID)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[POS_USP_FINISHBREFUND]";
             cmd.Parameters.AddWithValue("@BREFUNDID", BRefundID);
             int rowsaffected = cmd.ExecuteNonQuery();
             if (rowsaffected == 0)
             {
                 throw new Exception("Error while saving Branch Refund");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         SQLCon.Sqlconn().Close();
     }
 }
Пример #9
0
        public DataTable GetCounterList()
        {
            DataTable dtBranch = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlCloudconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_BRANCHCOUNTER]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtBranch);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving Branch Counter List", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtBranch);
        }
Пример #10
0
        public DataSet GetInitialLoad(object userID, object BranchID)
        {
            DataSet dSInitialLoad = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_BREFUND]";
                    cmd.Parameters.AddWithValue("@USERID", userID);
                    cmd.Parameters.AddWithValue("@BRANCHID", BranchID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dSInitialLoad);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving initial load details", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dSInitialLoad);
        }
Пример #11
0
        public DataTable GetPOSConfiguration()
        {
            DataTable dtPOSConfiguration = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_POSDETAILS]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtPOSConfiguration);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving POS Configuration", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtPOSConfiguration);
        }
        public DataTable GetEntityData(object locationID, string syncDirection)
        {
            DataTable dtEntity = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlCloudconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_GETSYNC]";
                    cmd.Parameters.AddWithValue("@LocationID", locationID);
                    cmd.Parameters.AddWithValue("@LocationType", "BranchCounter");
                    cmd.Parameters.AddWithValue("@SyncDirection", syncDirection);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retreiving Entity data List", ex);
            }
            finally
            {
                SQLCon.SqlCloudconn().Close();
            }
            return(dtEntity);
        }
Пример #13
0
        public DataTable GetNonEAN()
        {
            DataTable     dtItemCodes = new DataTable();
            SqlConnection conn        = SQLCon.Sqlconn();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_NONEAN]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtItemCodes);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving Item codes List", ex);
            }
            finally
            {
                conn.Close();
            }
            return(dtItemCodes);
        }
        public void SaveData(string entityName, DataTable dtEntityWiseData)
        {
            if (dtEntityWiseData?.Rows.Count == 0 || !entityMapping.ContainsKey(entityName))
            {
                return;
            }

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlSyncConn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = entityMapping[entityName].ProcedureName;
                    cmd.Parameters.AddWithValue(entityMapping[entityName].ParameterName, dtEntityWiseData);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Error While saving Entity {entityName} wise data List", ex);
            }
            finally
            {
                SQLCon.SqlSyncConn().Close();
            }
        }
        public DataSet GetDayClosureForReport(int dayClosureID)
        {
            DataSet dsDayClosure = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_RPT_DAYCLOSURE]";
                    cmd.Parameters.AddWithValue("@DAYCLOSUREID", dayClosureID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsDayClosure);
                    }
                    if (dsDayClosure != null && dsDayClosure.Tables.Count > 0)
                    {
                        dsDayClosure.Tables[0].TableName = "DAYCLOSURE";
                        dsDayClosure.Tables[1].TableName = "DENOMINATION";
                        dsDayClosure.Tables[2].TableName = "MOP";
                        dsDayClosure.Tables[3].TableName = "BILLS";
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting day closure", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dsDayClosure);
        }
Пример #16
0
        public DataSet GetUserInfo(object BranchID, object BranchCounterID, object Username, object PasswordString, string HDDSNo)
        {
            DataSet dSUserInfo = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_USERCREDENTIALS]";
                    cmd.Parameters.AddWithValue("@BRANCHID", BranchID);
                    cmd.Parameters.AddWithValue("@BRANCHCOUNTERID", BranchCounterID);
                    cmd.Parameters.AddWithValue("@USERNAME", Username);
                    cmd.Parameters.AddWithValue("@PASSWORDSTRING", PasswordString);
                    cmd.Parameters.AddWithValue("@HDDSNO", HDDSNo);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dSUserInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retrieving User Info", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dSUserInfo);
        }
        public DataTable GetMOPs()
        {
            DataTable dtMOPs = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_MOP]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtMOPs);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting mode of payments", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtMOPs);
        }
        public DataSet GetLastBill(int daySequenceID, object billID)
        {
            DataSet dsBillDetails = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_LASTBILL]";
                    cmd.Parameters.AddWithValue("@BillID", billID);
                    cmd.Parameters.AddWithValue("@DaySequenceID", daySequenceID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsBillDetails);
                    }

                    dsBillDetails.Tables[0].TableName = "BILL";
                    dsBillDetails.Tables[1].TableName = "BILLDETAILS";
                    dsBillDetails.Tables[2].TableName = "MOPDETAILS";
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting bill", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dsBillDetails);
        }
        public DataTable GetDraftBills(int daySequenceID)
        {
            DataTable draftBills = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_DRAFTBILLS]";
                    cmd.Parameters.AddWithValue("@DaySequenceID", daySequenceID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(draftBills);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting draft bills", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(draftBills);
        }
        public DataTable GetEntityWiseData(object EntityName, object SyncDate, object BranchID)
        {
            DataTable dtEntity = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlCloudconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_GETSYNCDATA]";
                    cmd.Parameters.AddWithValue("@EntityName", EntityName);
                    cmd.Parameters.AddWithValue("@SyncDate", SyncDate);
                    cmd.Parameters.AddWithValue("@BranchID", BranchID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Error While Retreiving Entity wise data List - {EntityName}", ex);
            }
            finally
            {
                SQLCon.SqlCloudconn().Close();
            }
            return(dtEntity);
        }
        public DataTable DeleteBillDetail(object billDetailID, object userID, DataTable dtSNos)
        {
            DataTable dtBillDetails = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_D_BILLDETAIL]";
                    cmd.Parameters.AddWithValue("@UserID", userID);
                    cmd.Parameters.AddWithValue("@BillDetailID", billDetailID);
                    cmd.Parameters.AddWithValue("@SNos", dtSNos);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtBillDetails);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While deleting bill detail", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }

            return(dtBillDetails);
        }
        public DataTable GetStockDispatches(object branchID)
        {
            DataTable dtStockDispatches = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_STOCKDISPATCH]";
                    cmd.Parameters.AddWithValue("@BranchID", branchID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtStockDispatches);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While getting stock in list", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtStockDispatches);
        }
        public DataSet GetDayClosure()
        {
            DataSet dsDayClosure = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_R_DAYCLOSURE]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsDayClosure);
                    }
                    if (dsDayClosure != null && dsDayClosure.Tables.Count > 0)
                    {
                        if (dsDayClosure.Tables[0].Rows.Count == 1)
                        {
                            throw new Exception(Convert.ToString(dsDayClosure.Tables[0].Rows[0][0]));
                        }
                        dsDayClosure.Tables[0].TableName = "DENOMINATION";
                        dsDayClosure.Tables[1].TableName = "MOP";
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("No Bills Available!"))
                {
                    throw ex;
                }
                else
                {
                    throw new Exception("Error While getting Day Closure", ex);
                }
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dsDayClosure);
        }
        public DataSet FinishBill(object userID, int daySequenceID, Bill billObj)
        {
            DataSet dsNextBill = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_FINISH_BILL]";
                    cmd.Parameters.AddWithValue("@UserID", userID);
                    cmd.Parameters.AddWithValue("@BillID", billObj.BillID);
                    cmd.Parameters.AddWithValue("@DaySequenceID", daySequenceID);
                    cmd.Parameters.AddWithValue("@CustomerName", billObj.CustomerName);
                    cmd.Parameters.AddWithValue("@CustomerNumber", billObj.CustomerNumber);
                    cmd.Parameters.AddWithValue("@Rounding", billObj.Rounding);
                    DataTable dtTemp = billObj.dtMopValues.Copy();
                    if (dtTemp.Columns.Contains("MOPNAME"))
                    {
                        dtTemp.Columns.Remove("MOPNAME");
                    }
                    cmd.Parameters.AddWithValue("@MopValues", dtTemp);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsNextBill);
                    }

                    dsNextBill.Tables[0].TableName = "BILL";
                    dsNextBill.Tables[1].TableName = "BILLDETAILS";
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While finishing and getting next bill", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dsNextBill);
        }
 public void ClearOldData()
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.SqlSyncConn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "POS_USP_D_OLD_DATA";
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"Error While clearing old data", ex);
     }
     finally
     {
         SQLCon.SqlSyncConn().Close();
     }
 }
        public int SaveDayClosure(object BranchCounterID, DataTable dtDenomination
                                  , DataTable dtMOP, object UserID, object RefundAmount, int DaySequenceID)
        {
            int DayClosureID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    dtDenomination.Columns.Remove("DISPLAYVALUE");
                    dtDenomination.Columns.Remove("MULTIPLIER");
                    dtDenomination.Columns.Remove("QUANTITY");
                    dtMOP.Columns.Remove("MOPNAME");

                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_CU_DAYCLOSURE]";
                    cmd.Parameters.AddWithValue("@BRANCHCOUNTERID", BranchCounterID);
                    cmd.Parameters.AddWithValue("@dtDenomination", dtDenomination);
                    cmd.Parameters.AddWithValue("@dtMOP", dtMOP);
                    cmd.Parameters.AddWithValue("@USERID", UserID);
                    cmd.Parameters.AddWithValue("@RefundAmount", RefundAmount);
                    cmd.Parameters.AddWithValue("@DaySequenceID", DaySequenceID);
                    object objReturn = cmd.ExecuteScalar();
                    if (!int.TryParse(Convert.ToString(objReturn), out DayClosureID))
                    {
                        throw new Exception("Error while saving day cllosure");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While saving Day Closure", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(DayClosureID);
        }
Пример #27
0
        public void InsertCRefund(DataTable dtRefund, object UserID)
        {
            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    DataTable dtCloned = dtRefund.Copy();
                    foreach (DataColumn dc in dtRefund.Columns)
                    {
                        if (dc.ColumnName == "BILLDETAILID" ||
                            dc.ColumnName == "REFUNDQUANTITY" ||
                            dc.ColumnName == "REFUNDWEIGHTINKGS" ||
                            dc.ColumnName == "REFUNDAMOUNT")
                        {
                            continue;
                        }
                        dtCloned.Columns.Remove(dc.ColumnName);
                    }

                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_CU_CREFUND]";
                    cmd.Parameters.AddWithValue("@dtRefund", dtCloned);
                    cmd.Parameters.AddWithValue("@UserID", UserID);
                    int ivalue = cmd.ExecuteNonQuery();
                    if (ivalue <= 0)
                    {
                        throw new Exception("Error while saving Refund Details!");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While saving Refund Details", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
        }
        public DataTable SaveBillDetail(object billID, object ItemPriceID, object quantity, object weightInKGS, object userID, object billDetailID)
        {
            DataTable      dtBillDetails = new DataTable();
            SqlTransaction transaction   = null;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    transaction     = SQLCon.Sqlconn().BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[POS_USP_CU_BILLDETAIL]";
                    cmd.Parameters.AddWithValue("@BillID", billID);
                    cmd.Parameters.AddWithValue("@ItemPriceID", ItemPriceID);
                    cmd.Parameters.AddWithValue("@Quantity", quantity);
                    cmd.Parameters.AddWithValue("@WeightInKgs", weightInKGS);
                    cmd.Parameters.AddWithValue("@UserID", userID);
                    cmd.Parameters.AddWithValue("@BillDetailID", billDetailID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtBillDetails);
                        transaction.Commit();
                    }
                }
            }
            catch (Exception ex)
            {
                transaction?.Rollback();
                throw ex;
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(dtBillDetails);
        }
 public void CheckOrAddHDDSerialNumber(object branchCounterID, string HDDSNo)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.SqlCloudconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[USP_U_BRANCHCOUNTER_HDDNO]";
             cmd.Parameters.AddWithValue("@BranchCounterID", branchCounterID);
             cmd.Parameters.AddWithValue("@HDDSNO", HDDSNo);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         SQLCon.SqlCloudconn().Close();
     }
 }
 public void UpdateEntitySyncStatus(object entitySyncStatusID, DateTime syncTime)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.SqlCloudconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[USP_U_ENTITYSYNCTIME]";
             cmd.Parameters.AddWithValue("@EntitySyncStatusID", entitySyncStatusID);
             cmd.Parameters.AddWithValue("@SyncTime", syncTime);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error While saving Entity sync status", ex);
     }
     finally
     {
         SQLCon.SqlCloudconn().Close();
     }
 }