public Category SaveCategory(Category ObjCategory)
        {
            int CategoryID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_CATEGORY]";
                    cmd.Parameters.AddWithValue("@CATEGORYID", ObjCategory.CATEGORYID);
                    cmd.Parameters.AddWithValue("@CATEGORYNAME", ObjCategory.CATEGORYNAME);
                    cmd.Parameters.AddWithValue("@ALLOWOPENITEMS", ObjCategory.AllowOpenItems);
                    cmd.Parameters.AddWithValue("@USERID", ObjCategory.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out CategoryID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjCategory.CATEGORYID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("UC_CATEGORYNAME"))
                {
                    throw new Exception("Category Already Exists!!");
                }
                else
                {
                    throw new Exception("Error While Saving Category");
                }
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjCategory);
        }
        public PrinterSettings SavePrinterSettings(PrinterSettings ObjPrinterSettings)
        {
            int PRINTERSETTINGSID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_PRINTERSETTINGS]";
                    cmd.Parameters.AddWithValue("@PRINTERSETTINGSID", ObjPrinterSettings.PRINTERSETTINGSID);
                    cmd.Parameters.AddWithValue("@PRINTERTYPEID", ObjPrinterSettings.PRINTERTYPEID);
                    cmd.Parameters.AddWithValue("@PRINTERNAME", ObjPrinterSettings.PRINTERNAME);
                    cmd.Parameters.AddWithValue("@USERID", ObjPrinterSettings.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out PRINTERSETTINGSID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjPrinterSettings.PRINTERSETTINGSID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("UC_PRINTERSETTING"))
                {
                    throw new Exception("Printer Already Exists!!");
                }
                else
                {
                    throw new Exception("Error While Saving Printer");
                }
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjPrinterSettings);
        }
        public MOP SaveMOP(MOP ObjMOP)
        {
            int MOPID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_MOP]";
                    cmd.Parameters.AddWithValue("@MOPID", ObjMOP.MOPID);
                    cmd.Parameters.AddWithValue("@MOPNAME", ObjMOP.MOPNAME);
                    cmd.Parameters.AddWithValue("@USERID", ObjMOP.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out MOPID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjMOP.MOPID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("UC_MOPNAME"))
                {
                    throw new Exception("MOP Already Exists!!");
                }
                else
                {
                    throw new Exception("Error While Saving MOP");
                }
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjMOP);
        }
Esempio n. 4
0
        /// <summary>
        /// Code to fetch non active deliveries from database
        /// </summary>
        /// <param name="ObjEDeliveryNotes"></param>
        /// <returns></returns>
        public EDeliveryNotes GetNonActiveDelivery(EDeliveryNotes ObjEDeliveryNotes)
        {
            DataSet dsPositions = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_NonActivedelivery]";
                    cmd.Parameters.AddWithValue("@ProjectID", ObjEDeliveryNotes.ProjectID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsPositions);
                    }
                    ObjEDeliveryNotes.dtNonActivedelivery = dsPositions.Tables[0];
                    if (ObjEDeliveryNotes.dtNonActivedelivery.Rows.Count > 0 && dsPositions.Tables[1].Rows.Count > 0)
                    {
                        ObjEDeliveryNotes.BlattID = dsPositions.Tables[1].Rows[0]["BlattID"] == DBNull.Value
                            ? -1 : Convert.ToInt32(dsPositions.Tables[1].Rows[0]["BlattID"]);
                        ObjEDeliveryNotes.BlattName = dsPositions.Tables[1].Rows[0]["BlattNumber"] == DBNull.Value
                            ? "" : dsPositions.Tables[1].Rows[0]["BlattNumber"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Error While Retrieving the Positions");
                }
                else
                {
                    throw new Exception("Error While Retrieving the Positions");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEDeliveryNotes);
        }
Esempio n. 5
0
 /// <summary>
 /// Code to update long description of position
 /// </summary>
 /// <param name="PositionID"></param>
 /// <param name="strLongDescription"></param>
 public void UpdateLongDescription(int PositionID, string strLongDescription)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[P_Upd_LongDescription]";
             cmd.Parameters.AddWithValue("@PositionID", PositionID);
             cmd.Parameters.AddWithValue("@LongDescription", strLongDescription);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Code to fetch special cost of a project
 /// </summary>
 /// <param name="ObjEUmlage"></param>
 /// <returns></returns>
 public EUmlage GetSpecialCost(EUmlage ObjEUmlage)
 {
     try
     {
         ObjEUmlage.dtSpecialCost = new DataTable();
         DataSet ds = new DataSet();
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[P_Get_SpecialCost]";
             cmd.Parameters.Add("@ProjectID", ObjEUmlage.ProjectID);
             using (SqlDataAdapter da = new SqlDataAdapter(cmd))
             {
                 da.Fill(ds);
             }
             if (ds != null && ds.Tables.Count > 0)
             {
                 ObjEUmlage.dtSpecialCost = ds.Tables[0];
                 if (ds.Tables.Count > 1 && ds.Tables[1].Rows.Count > 0)
                 {
                     int.TryParse(Convert.ToString(ds.Tables[1].Rows[0][0]), out ObjEUmlage.UmlageMode);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
         {
             throw new Exception("Fehler beim Laden der Generellen Kosten");
         }
         else
         {
             throw new Exception("Error while retrieving special cost");
         }
     }
     finally
     {
         SQLCon.Close();
     }
     return(ObjEUmlage);
 }
Esempio n. 7
0
        /// <summary>
        /// Code to fetch article Prices from database by  using Article number and Dimenstions
        /// </summary>
        /// <param name="ObjEPositon"></param>
        /// <returns></returns>
        public EPosition GetArticleByDimension(EPosition ObjEPositon)
        {
            DataTable dt = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_ArticleByDimension]";
                    cmd.Parameters.AddWithValue("@WG", ObjEPositon.WG);
                    cmd.Parameters.AddWithValue("@WA", ObjEPositon.WA);
                    cmd.Parameters.AddWithValue("@WI", ObjEPositon.WI);
                    cmd.Parameters.AddWithValue("@A", ObjEPositon.Dim1);
                    cmd.Parameters.AddWithValue("@B", ObjEPositon.Dim2);
                    cmd.Parameters.AddWithValue("@L", ObjEPositon.Dim3);
                    cmd.Parameters.AddWithValue("@dtSubmitDate", ObjEPositon.ValidityDate);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dt);
                    }
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        ObjEPositon.dtDimensions = dt.Copy();
                        ObjEPositon.LPMA         = dt.Rows[0]["ListPrice"] == DBNull.Value ? 1 : Convert.ToDecimal(dt.Rows[0]["ListPrice"]);
                        ObjEPositon.Mins         = dt.Rows[0]["Minuten"] == DBNull.Value ? 1 : Convert.ToDecimal(dt.Rows[0]["Minuten"]);
                        ObjEPositon.Faktor       = dt.Rows[0]["Factor"] == DBNull.Value ? 1 : Convert.ToDecimal(dt.Rows[0]["Factor"]);
                        DateTime dtdate = DateTime.Now;
                        if (DateTime.TryParse(Convert.ToString(dt.Rows[0]["ValidityDate"]), out dtdate))
                        {
                            ObjEPositon.ValidityDate = dtdate;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(ObjEPositon);
        }
Esempio n. 8
0
        /// <summary>
        /// Code to fetch article details and dimensions list from database by  using typ
        /// </summary>
        /// <param name="ObjEPositon"></param>
        /// <returns></returns>
        public EPosition GetArticleByTyp(EPosition ObjEPositon)
        {
            DataSet ds = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_ArticleByType]";
                    cmd.Parameters.AddWithValue("@Typ", ObjEPositon.Type);
                    cmd.Parameters.AddWithValue("@dtSubmitDate", ObjEPositon.ValidityDate);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(ds);
                    }
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        ObjEPositon.dtArticle  = ds.Tables[0];
                        ObjEPositon.WG         = ds.Tables[0].Rows[0]["WG"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["WG"].ToString();
                        ObjEPositon.WA         = ds.Tables[0].Rows[0]["WA"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["WA"].ToString();
                        ObjEPositon.WI         = ds.Tables[0].Rows[0]["WI"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["WI"].ToString();
                        ObjEPositon.Fabricate  = ds.Tables[0].Rows[0]["Fabrikate"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["Fabrikate"].ToString();
                        ObjEPositon.ME         = ds.Tables[0].Rows[0]["Menegenheit"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["Menegenheit"].ToString();
                        ObjEPositon.Dim        = ds.Tables[0].Rows[0]["Masseinheit"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["Masseinheit"].ToString();
                        ObjEPositon.Faktor     = ds.Tables[0].Rows[0]["Factor"] == DBNull.Value ? 1 : Convert.ToDecimal(ds.Tables[0].Rows[0]["Factor"]);
                        ObjEPositon.LiefrantMA = ds.Tables[0].Rows[0]["FullName"] == DBNull.Value ? "" : ds.Tables[0].Rows[0]["FullName"].ToString();
                        ObjEPositon.Multi1MA   = ds.Tables[0].Rows[0]["Multi1"] == DBNull.Value ? 1 : Convert.ToDecimal(ds.Tables[0].Rows[0]["Multi1"]);
                        ObjEPositon.Multi2MA   = ds.Tables[0].Rows[0]["Multi2"] == DBNull.Value ? 1 : Convert.ToDecimal(ds.Tables[0].Rows[0]["Multi2"]);
                        ObjEPositon.Multi3MA   = ds.Tables[0].Rows[0]["Multi3"] == DBNull.Value ? 1 : Convert.ToDecimal(ds.Tables[0].Rows[0]["Multi3"]);
                        ObjEPositon.Multi4MA   = ds.Tables[0].Rows[0]["Multi4"] == DBNull.Value ? 1 : Convert.ToDecimal(ds.Tables[0].Rows[0]["Multi4"]);
                        if (ds.Tables.Count > 1)
                        {
                            ObjEPositon.dtDimensions = ds.Tables[1];
                        }
                    }
                }
            }
            catch (Exception ex) { throw; }
            return(ObjEPositon);
        }
Esempio n. 9
0
        /// <summary>
        /// Code to get Organization details
        /// </summary>
        /// <param name="ObjEOTTO"></param>
        /// <returns></returns>
        public EOTTO GetOTTODetails(EOTTO ObjEOTTO)
        {
            DataSet dsOTTO = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_OTTODetails]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsOTTO);
                    }
                    if (dsOTTO != null && dsOTTO.Tables.Count > 0)
                    {
                        ObjEOTTO.dtOTTO = dsOTTO.Tables[0];
                        if (dsOTTO.Tables.Count > 1)
                        {
                            ObjEOTTO.dtContact = dsOTTO.Tables[1];
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden der daten zu OTTO");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving OTTO details");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEOTTO);
        }
Esempio n. 10
0
        /// <summary>
        /// Code to export positions from supplier proposal
        /// </summary>
        /// <param name="SupplierProposalID"></param>
        /// <returns></returns>
        public DataSet GetSupplierProposalExport(int SupplierProposalID)
        {
            DataSet dsTMLData = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[p_Get_SupplierProposalExport]";
                    cmd.Parameters.AddWithValue("@SupplierProposalID", SupplierProposalID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsTMLData, "TMLData");
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("RasterError"))
                {
                    throw new Exception("Betrieb nicht möglich mit altem Raster");
                }
                else
                {
                    if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                    {
                        throw new Exception("Fehler beim Laden der Positionsliste");
                    }
                    else
                    {
                        throw new Exception("Error Occured While Retreiving Position List");
                    }
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(dsTMLData);
        }
Esempio n. 11
0
        /// <summary>
        /// Code to update values to position from Bulk proccess Section A
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <param name="tType"></param>
        /// <param name="MA_Selbstkosten"></param>
        /// <param name="MO_Selbstkosten"></param>
        /// <param name="MA_Verkaufspreis"></param>
        /// <param name="MO_Verkaufspreis"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public DataSet UpdateBulkProcess_ActionA(int ProjectID, string tType, decimal MA_Selbstkosten, decimal MO_Selbstkosten, decimal MA_Verkaufspreis, decimal MO_Verkaufspreis, DataTable dt)
        {
            DataSet dsPositionsOZList = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Upd_BulkProcess_ActionA]";
                    cmd.Parameters.AddWithValue("@ProjectID", ProjectID);
                    cmd.Parameters.AddWithValue("@Position_Type", tType);
                    cmd.Parameters.AddWithValue("@MA_selbstkostenMulti", MA_Selbstkosten);
                    cmd.Parameters.AddWithValue("@MO_selbstkostenMulti", MO_Selbstkosten);
                    cmd.Parameters.AddWithValue("@MA_verkaufspreis_Multi", MA_Verkaufspreis);
                    cmd.Parameters.AddWithValue("@MO_verkaufspreisMulti", MO_Verkaufspreis);
                    cmd.Parameters.AddWithValue("@Bulk_Process_ActionA_Table", dt);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsPositionsOZList, "Positions");
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden der Positionsliste");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving Position OZ List");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(dsPositionsOZList);
        }
Esempio n. 12
0
        /// <summary>
        /// Code to get Articles based on cost type mapping
        /// </summary>
        /// <param name="ObjEFormBlatt"></param>
        /// <returns></returns>
        public EFormBlatt Get_FormBlattArticles(EFormBlatt ObjEFormBlatt)
        {
            DataSet dsFormBlattArticle = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_ArticleForFormBlatt]";
                    cmd.Parameters.Add("@CostTypeID", ObjEFormBlatt.LookUpID);
                    cmd.Parameters.Add("@ProjectID", ObjEFormBlatt.ProjectID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFormBlattArticle);
                    }
                    if (dsFormBlattArticle != null && dsFormBlattArticle.Tables.Count > 0)
                    {
                        ObjEFormBlatt.dtBlattArticles = dsFormBlattArticle.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Ein Fehler ist aufgetreten beim Laden des Formulars (Artikel)");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving FormBlatt Articles");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEFormBlatt);
        }
Esempio n. 13
0
        public int SavePositionDetails(XmlDocument XmlDoc, byte[] LongDescription)
        {
            int ProjectID = -1;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Ins_Position]";
                    SqlParameter param = new SqlParameter("@XMLPositions", SqlDbType.Xml);
                    param.Value = XmlDoc.InnerXml;
                    cmd.Parameters.Add(param);
                    cmd.Parameters.AddWithValue("@LongDescription", LongDescription);

                    object returnObj = cmd.ExecuteScalar();
                    if (returnObj != null)
                    {
                        if (returnObj.ToString().Contains("UNIQUE"))
                        {
                            throw new Exception("OZ Already Exists");
                        }
                        else if (!int.TryParse(returnObj.ToString(), out ProjectID))
                        {
                            throw new Exception("Error Occured While Saving the Position Details");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ProjectID);
        }
Esempio n. 14
0
        public int SaveOffer(Offer offer)
        {
            int OfferID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_OFFER]";
                    cmd.Parameters.AddWithValue("@OfferID", offer.OfferID);
                    cmd.Parameters.AddWithValue("@OfferName", offer.OfferName);
                    cmd.Parameters.AddWithValue("@OfferCode", offer.OfferCode);
                    cmd.Parameters.AddWithValue("@StartDate", offer.StartDate);
                    cmd.Parameters.AddWithValue("@EndDate", offer.EndDate);
                    cmd.Parameters.AddWithValue("@OfferValue", offer.OfferValue);
                    cmd.Parameters.AddWithValue("@AppliesToID", offer.AppliesToID);
                    cmd.Parameters.AddWithValue("@OfferTypeID", offer.OfferTypeID);
                    cmd.Parameters.AddWithValue("@CategoryID", offer.CategoryID);
                    cmd.Parameters.AddWithValue("@ItemGroupID", offer.ItemGroupID);
                    cmd.Parameters.AddWithValue("@IsActive", offer.IsActive);
                    cmd.Parameters.AddWithValue("@UserID", offer.UserID);
                    object objreturn = cmd.ExecuteScalar();
                    if (!int.TryParse(objreturn.ToString(), out OfferID))
                    {
                        throw new Exception("Error while saivng offer");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While saving offer", ex);
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(OfferID);
        }
Esempio n. 15
0
        /// <summary>
        /// Code to save Role and feature mapping
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public EUserInfo SaveFeatureMap(EUserInfo ObjEUserInfo, DataTable dt)
        {
            DataSet dsFeature = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Ins_RoleFeatureMap]";
                    cmd.Parameters.Add("@RoleID", ObjEUserInfo.RoleID);
                    cmd.Parameters.Add("@dtFeatureMap", dt);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFeature);
                    }
                    if (dsFeature != null && dsFeature.Tables.Count > 0)
                    {
                        ObjEUserInfo.dtFeature = dsFeature.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler bei der Zuordnung einer Berechtigung zu einer Rolle");
                }
                else
                {
                    throw new Exception("Error Occured While Mapping Features To Role");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEUserInfo);
        }
Esempio n. 16
0
        public StockDispatchDetail SaveDispatchDetail(StockDispatchDetail ObjStockDispatchDetail)
        {
            int StockDispatchDetailID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_STOCKDISPATCHDETAIL]";
                    cmd.Parameters.AddWithValue("@STOCKDISPATCHDETAILID", ObjStockDispatchDetail.STOCKDISPATCHDETAILID);
                    cmd.Parameters.AddWithValue("@STOCKDISPATCHID", ObjStockDispatchDetail.STOCKDISPATCHID);
                    cmd.Parameters.AddWithValue("@ITEMPRICEID", ObjStockDispatchDetail.ITEMPRICEID);
                    cmd.Parameters.AddWithValue("@TRAYNUMBER", ObjStockDispatchDetail.TRAYNUMBER);
                    cmd.Parameters.AddWithValue("@DISPATCHQUANTITY", ObjStockDispatchDetail.DISPATCHQUANTITY);
                    cmd.Parameters.AddWithValue("@WEIGHTINKGS", ObjStockDispatchDetail.WEIGHTINKGS);
                    cmd.Parameters.AddWithValue("@USERID", ObjStockDispatchDetail.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out StockDispatchDetailID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjStockDispatchDetail.STOCKDISPATCHDETAILID = StockDispatchDetailID;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Saving Dispatch Detail");
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjStockDispatchDetail);
        }
Esempio n. 17
0
        /// <summary>
        /// Code to fetch feature list from database
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public EUserInfo GetFeatureDetails(EUserInfo ObjEUserInfo)
        {
            DataSet dsFeature = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_Feature]";
                    cmd.Parameters.Add("@RoleID", ObjEUserInfo.RoleID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFeature);
                    }
                    if (dsFeature != null && dsFeature.Tables.Count > 0)
                    {
                        ObjEUserInfo.dtFeature = dsFeature.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden von Daten");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving Features");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEUserInfo);
        }
        public DataSet GetUserCredentials(string UserName, string Password)
        {
            DataSet dSUser = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_USERLOGIN]";
                    cmd.Parameters.AddWithValue("@USERNAME", UserName);
                    cmd.Parameters.AddWithValue("@PASSWORD", Password);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dSUser);
                    }
                    if (dSUser != null && dSUser.Tables[0].Rows.Count > 0)
                    {
                        int    Ivalue = 0;
                        string str    = Convert.ToString(dSUser.Tables[0].Rows[0][0]);
                        if (!int.TryParse(str, out Ivalue))
                        {
                            throw new Exception(str);
                        }
                    }
                    else
                    {
                        throw new Exception("Error in login");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { SQLCon.Sqlconn().Close(); }
            return(dSUser);
        }
Esempio n. 19
0
 /// <summary>
 ///  Code to get Formblatt 221 table 2 values
 /// </summary>
 /// <param name="ObjEFormBlatt"></param>
 /// <returns></returns>
 public EFormBlatt Get_tbl221_2(EFormBlatt ObjEFormBlatt)
 {
     try
     {
         DataSet ds = new DataSet();
         ObjEFormBlatt.dtBlatt221_2 = new DataTable();
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[P_Get_tbl221_2]";
             cmd.Parameters.Add("@ProjectID", ObjEFormBlatt.ProjectID);
             using (SqlDataAdapter da = new SqlDataAdapter(cmd))
             {
                 da.Fill(ds);
             }
             if (ds != null && ds.Tables.Count > 0)
             {
                 ObjEFormBlatt.dtBlatt221_2 = ds.Tables[0];
             }
         }
     }
     catch (Exception ex)
     {
         if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
         {
             // throw new Exception("Fehler beim Laden der Generellen Kosten");
         }
         else
         {
             throw new Exception("Error while retrieving form blatt");
         }
     }
     finally
     {
         SQLCon.Close();
     }
     return(ObjEFormBlatt);
 }
Esempio n. 20
0
        /// <summary>
        /// Code to fetch report settings from database
        /// </summary>
        /// <param name="ObjEObject"></param>
        /// <returns></returns>
        public DataSet GetReportSettings(EReportDesign ObjEReportDesign)
        {
            DataSet dsReportSetting = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_ReportSetting]";

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsReportSetting);
                    }
                    if (dsReportSetting != null && dsReportSetting.Tables.Count > 0)
                    {
                        ObjEReportDesign.dtReportSettings = dsReportSetting.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden der Daten");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving the data");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(dsReportSetting);
        }
Esempio n. 21
0
 public void DeleteInvoiceDetail(object StockEntryDetailID)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[USP_D_STOCKENTRYDETAIL]";
             cmd.Parameters.AddWithValue("@STOCKENTRYDETAILID", StockEntryDetailID);
             object objReturn = cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error While Deleting Invoice Detail");
     }
     finally
     {
         SQLCon.Sqlconn().Close();
     }
 }
Esempio n. 22
0
 public void UpdateDispatch(StockDispatch ObjStockDispatch)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[USP_U_STOCKDISPATCH]";
             cmd.Parameters.AddWithValue("@STOCKDISPATCHID", ObjStockDispatch.STOCKDISPATCHID);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error While Updating Dispatch");
     }
     finally
     {
         SQLCon.Sqlconn().Close();
     }
 }
Esempio n. 23
0
        /// <summary>
        /// Code to fetch access levels for selected role
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public EUserInfo GetAceesLevels(EUserInfo ObjEUserInfo)
        {
            DataSet dsAccessLevels = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_AccessLevels]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsAccessLevels);
                    }
                    if (dsAccessLevels != null && dsAccessLevels.Tables.Count > 0)
                    {
                        ObjEUserInfo.dtAccessLevels = dsAccessLevels.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden der Zugangsinformationen");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving Access Levels");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEUserInfo);
        }
Esempio n. 24
0
        public StockDispatch SaveDispatch(StockDispatch ObjStockDispatch)
        {
            int StockDispatchID = 0;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_CU_STOCKDISPATCH]";
                    cmd.Parameters.AddWithValue("@STOCKDISPATCHID", ObjStockDispatch.STOCKDISPATCHID);
                    cmd.Parameters.AddWithValue("@FROMBRANCHID", ObjStockDispatch.FROMBRANCHID);
                    cmd.Parameters.AddWithValue("@TOBRANCHID", ObjStockDispatch.TOBRANCHID);
                    cmd.Parameters.AddWithValue("@CATEGORYID", ObjStockDispatch.CATEGORYID);
                    cmd.Parameters.AddWithValue("@USERID", ObjStockDispatch.UserID);
                    object objReturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(objReturn);
                    if (!int.TryParse(str, out StockDispatchID))
                    {
                        throw new Exception(str);
                    }
                    else
                    {
                        ObjStockDispatch.STOCKDISPATCHID = objReturn;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Saving Dispatch");
            }
            finally
            {
                SQLCon.Sqlconn().Close();
            }
            return(ObjStockDispatch);
        }
Esempio n. 25
0
        /// <summary>
        /// Code to fetch Positions from database for bulk proccess module by filtering with article
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <param name="tType"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public DataSet GetPsoitionOZByWGWA(int ProjectID, string tType, string WG, string WA)
        {
            DataSet dsPositionsOZList = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_PositionOZ]";
                    cmd.Parameters.AddWithValue("@ProjectID", ProjectID);
                    cmd.Parameters.AddWithValue("@Position_Type", tType);
                    cmd.Parameters.AddWithValue("@WG", WG);
                    cmd.Parameters.AddWithValue("@WA", WA);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsPositionsOZList, "Positions");
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Fehler beim Laden der Positionsliste");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving Position OZ List");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(dsPositionsOZList);
        }
Esempio n. 26
0
        /// <summary>
        /// Code to get Cost types
        /// </summary>
        /// <param name="ObjEFormBlatt"></param>
        /// <returns></returns>
        public EFormBlatt GetFormBlatttype(EFormBlatt ObjEFormBlatt)
        {
            DataSet dsFormBlatt = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_FormBlattType]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFormBlatt);
                    }
                    if (dsFormBlatt != null && dsFormBlatt.Tables.Count > 0)
                    {
                        ObjEFormBlatt.dtBlattTypes = dsFormBlatt.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Ein Fehler ist aufgetreten beim Laden des Formulars (Kostentypen)");
                }
                else
                {
                    throw new Exception("Error Occured While Retreiving Access FormBlatt Types");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEFormBlatt);
        }
Esempio n. 27
0
        public DataTable GetPositionKZ()
        {
            DataTable dt = null;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_PositionList]";
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dt);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(dt);
        }
Esempio n. 28
0
 /// <summary>
 /// Code to get Project specific Articles
 /// </summary>
 /// <param name="ObjEPositon"></param>
 /// <returns></returns>
 public EPosition GetProjectArticles(EPosition ObjEPositon)
 {
     try
     {
         ObjEPositon.dtProjectArticles = new DataTable();
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[P_Get_ProjectArticles]";
             cmd.Parameters.AddWithValue("@ProjectID", ObjEPositon.ProjectID);
             using (SqlDataAdapter da = new SqlDataAdapter(cmd))
             {
                 da.Fill(ObjEPositon.dtProjectArticles);
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEPositon);
 }
 public void ResetPassword(object UserID, string PasswordString)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.Sqlconn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "[USP_U_CHANGEPASSWORD]";
             cmd.Parameters.AddWithValue("@USERID", UserID);
             cmd.Parameters.AddWithValue("@PASSWORDSTRING", PasswordString);
             if (cmd.ExecuteNonQuery() == 0)
             {
                 throw new Exception("Error while resetting the password");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally { SQLCon.Sqlconn().Close(); }
 }
Esempio n. 30
0
        /// <summary>
        /// Code to save Cost type mapping with articles
        /// </summary>
        /// <param name="ObjEFormBlatt"></param>
        /// <param name="_dt"></param>
        /// <returns></returns>
        public EFormBlatt Save_FormBlattArticles(EFormBlatt ObjEFormBlatt, DataTable _dt)
        {
            DataSet dsFormBlattArticle = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Ins_FormBlattarticles]";
                    cmd.Parameters.Add("@LookupID", ObjEFormBlatt.LookUpID);
                    cmd.Parameters.Add("@dtBlattArticles", _dt);
                    cmd.Parameters.Add("@ProjectID", ObjEFormBlatt.ProjectID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFormBlattArticle);
                    }
                }
            }
            catch (Exception ex)
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                {
                    throw new Exception("Ein Fehler ist aufgetreten beim Speichern des Formulars");
                }
                else
                {
                    throw new Exception("Error Occured While Saving Titles Articles");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEFormBlatt);
        }