Beispiel #1
0
        public RefTransferHeader GetTransferHeader(int transferid)
        {
            bool                result     = false;
            string              sql        = "sp_TransfetHeader_GetById";
            RefTransferHeader   header     = null;
            SqlCommand          sqlCommand = null;
            List <SqlParameter> paramList  = new List <SqlParameter>();
            SqlConnection       conn       = null;
            SqlDataReader       reader     = null;

            try
            {
                paramList = new List <SqlParameter>();
                paramList.Add(new SqlParameter("@TransferId", transferid));

                webdb.OpenConnection();
                conn                   = webdb.Connection;
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = conn;
                sqlCommand.Parameters.AddRange(paramList.ToArray());

                reader = sqlCommand.ExecuteReader();
                //   if (reader.Read())
                //  {

                header = Converting.ConvertDataReaderToObjList <RefTransferHeader>(reader).FirstOrDefault();
                if (header != null)
                {
                    reader.NextResult();

                    header.TransferDetail = Converting.ConvertDataReaderToObjList <TransferDetail>(reader);
                    reader.NextResult();

                    header.TransferRefHeader = Converting.ConvertDataReaderToObjList <TransferRefHeader>(reader);
                }



                // }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                webdb.CloseConnection();
            }



            return(header);
        }
Beispiel #2
0
        public TransactionStatus GetAllStatus(string AccountId)
        {
            string sql = "sp_GetAllStatus";
            List <SqlParameter> paramList = new List <SqlParameter>();

            TransactionStatus dto        = null;
            SqlDataReader     reader     = null;
            SqlCommand        sqlCommand = null;


            try
            {
                webdb.OpenConnection();
                paramList.Add(new SqlParameter("@AccountId", AccountId));

                //connect.Open();
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = webdb.Connection;
                sqlCommand.Parameters.AddRange(paramList.ToArray());

                reader = sqlCommand.ExecuteReader();
                if (reader.Read())
                {
                    dto           = new TransactionStatus();
                    dto.QuoState1 = reader["QuoState1"].ToString();
                    dto.QuoState2 = reader["QuoState2"].ToString();
                    dto.QuoState3 = reader["QuoState3"].ToString();
                    dto.QuoState4 = reader["QuoState4"].ToString();

                    dto.SOState1 = reader["SOState1"].ToString();
                    dto.SOState2 = reader["SOState2"].ToString();
                    dto.SOState3 = reader["SOState3"].ToString();

                    dto.InvState1      = reader["InvState1"].ToString();
                    dto.InvState2      = reader["InvState2"].ToString();
                    dto.InvState3      = reader["InvState3"].ToString();
                    dto.InvState4      = reader["InvState4"].ToString();
                    dto.JobOrderState1 = reader["JobOrderState1"].ToString();
                    dto.JobOrderState2 = reader["JobOrderState2"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                if (webdb.Connection.State == ConnectionState.Open)
                {
                    webdb.CloseConnection();
                }
            }



            return(dto);
        }
Beispiel #3
0
        public List <SysMenu> GetMenuByRole(int roleId)
        {
            string sql = "GetMenuActive";
            List <SqlParameter> paramList  = new List <SqlParameter>();
            List <SysMenu>      list       = new List <SysMenu>();
            SysMenu             dto        = null;
            SqlDataReader       reader     = null;
            SqlCommand          sqlCommand = null;


            try
            {
                webdb.OpenConnection();
                paramList.Add(new SqlParameter("@RoleId", roleId));

                //connect.Open();
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = webdb.Connection;
                sqlCommand.Parameters.AddRange(paramList.ToArray());

                reader = sqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    dto               = new SysMenu();
                    dto.MenuId        = Converting.ToInt(reader["MenuId"].ToString());
                    dto.SiteId        = Converting.ToInt(reader["SiteId"].ToString());
                    dto.MenuName      = reader["MenuName"].ToString();
                    dto.MenuIcon      = reader["MenuIcon"].ToString();
                    dto.MenuOrder     = Converting.ToInt(reader["MenuOrder"].ToString());
                    dto.ParentId      = Converting.ToInt(reader["ParentId"].ToString());
                    dto.MvcArea       = reader["MvcArea"].ToString();
                    dto.MvcController = reader["MvcController"].ToString();
                    dto.MvcAction     = reader["MvcAction"].ToString();
                    dto.FlagActive    = Converting.ToBoolean(reader["FlagActive"].ToString());
                    dto.View          = Converting.ToInt(reader["View"].ToString());
                    dto.Edit          = Converting.ToInt(reader["Edit"].ToString());
                    dto.Delete        = Converting.ToInt(reader["Delete"].ToString());
                    list.Add(dto);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                if (webdb.Connection.State == ConnectionState.Open)
                {
                    webdb.CloseConnection();
                }
            }



            return(list);
        }
Beispiel #4
0
        public bool SaleOrderStockApprove(int SaleOrderId)
        {
            string sql = "sp_SaleOrderStockApprove";
            List <SqlParameter> paramList  = new List <SqlParameter>();
            List <TblSaleOrder> list       = new List <TblSaleOrder>();
            TblSaleOrder        dto        = null;
            SqlDataReader       reader     = null;
            SqlCommand          sqlCommand = null;
            bool success = true;

            try
            {
                webdb.OpenConnection();
                paramList.Add(new SqlParameter("@SaleOrderId", SaleOrderId));
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = webdb.Connection;
                sqlCommand.Parameters.AddRange(paramList.ToArray());

                sqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                success = false;
                throw new Exception(ex.ToString());
            }
            finally
            {
                if (webdb.Connection.State == ConnectionState.Open)
                {
                    webdb.CloseConnection();
                }
            }


            return(success);
        }
        public void SetVersion(TblQuotationTemplate ob)
        {
            string sql = "sp_TblQuotation_Version_Add";
            List <SqlParameter> paramList  = new List <SqlParameter>();
            List <TblSaleOrder> list       = new List <TblSaleOrder>();
            TblSaleOrder        dto        = null;
            SqlDataReader       reader     = null;
            SqlCommand          sqlCommand = null;
            int result = 0;

            try
            {
                webdb.OpenConnection();
                paramList.Add(new SqlParameter("@QuotationId", ob.QuotationId));
                paramList.Add(new SqlParameter("@TempQuotationId", ob.TempQuotationId));
                //connect.Open();
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = webdb.Connection;
                sqlCommand.Parameters.AddRange(paramList.ToArray());

                result = sqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                if (webdb.Connection.State == ConnectionState.Open)
                {
                    webdb.CloseConnection();
                }
            }
        }