public List <CBranch> BranchDetailList(int CompanyID)
        {
            List <CBranch> oResult = new List <CBranch>();

            try
            {
                // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET
                DataSet dsBranchInfo = _sqlService.GetDataSet("TBranchInfo", "uspBranchInfoGet " + CompanyID + ", 0");

                using (DataTable dtBranchInfo = dsBranchInfo.Tables["TBranchInfo"])
                {
                    if (dtBranchInfo.Rows.Count > 0)
                    {
                        for (int iRow = 0; iRow <= dtBranchInfo.Rows.Count - 1; iRow++)
                        {
                            // SET THE DATASET INFORMATION TO THE RETURN VALUE
                            oResult.Add(new CBranch()
                            {
                                BranchID              = Convert.ToInt32(dtBranchInfo.Rows[iRow]["BranchID"].ToString()),
                                CompanyID             = Convert.ToInt32(dtBranchInfo.Rows[iRow]["CompanyID"].ToString()),
                                Name                  = dtBranchInfo.Rows[iRow]["Name"].ToString(),
                                Address               = dtBranchInfo.Rows[iRow]["Address"].ToString(),
                                Email                 = dtBranchInfo.Rows[iRow]["Email"].ToString(),
                                Location              = dtBranchInfo.Rows[iRow]["Location"].ToString(),
                                Mobile                = dtBranchInfo.Rows[iRow]["Mobile"].ToString(),
                                Status                = dtBranchInfo.Rows[iRow]["Status"].ToString(),
                                LastLogged            = Convert.ToDateTime(dtBranchInfo.Rows[iRow]["LastLogged"].ToString()),
                                LoginBeforeLastLogged = Convert.ToDateTime(dtBranchInfo.Rows[iRow]["LoginBeforeLastLogged"].ToString())
                            });
                        }
                    }
                    return(oResult);
                }
            }
            catch (Exception ex)
            {
                oResult.Add(new CBranch()
                {
                    Success       = false,
                    WasSuccessful = 0,
                    Exception     = ex.Message
                });
                return(oResult);
            }
        }
        public List <CCompany> CompanyDetailList()
        {
            List <CCompany> oResult = new List <CCompany>();

            try
            {
                // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET
                DataSet dsCompanyInfo = _sqlService.GetDataSet("TCompanyInfo", "uspCompanyInfoGet 0");

                using (DataTable dtCompanyInfo = dsCompanyInfo.Tables["TCompanyInfo"])
                {
                    if (dtCompanyInfo.Rows.Count > 0)
                    {
                        for (int iRow = 0; iRow <= dtCompanyInfo.Rows.Count - 1; iRow++)
                        {
                            // SET THE DATASET INFORMATION TO THE RETURN VALUE
                            oResult.Add(new CCompany()
                            {
                                CompanyID             = Convert.ToInt64(dtCompanyInfo.Rows[iRow]["CompanyID"].ToString()),
                                Name                  = dtCompanyInfo.Rows[iRow]["Name"].ToString(),
                                Address               = dtCompanyInfo.Rows[iRow]["Address"].ToString(),
                                Email                 = dtCompanyInfo.Rows[iRow]["Email"].ToString(),
                                Mobile                = dtCompanyInfo.Rows[iRow]["Mobile"].ToString(),
                                LogoImgPath           = _sqlService.ImagePathGet(dtCompanyInfo.Rows[iRow]["LogoImage"].ToString(), 0, string.Empty),
                                Status                = dtCompanyInfo.Rows[iRow]["Status"].ToString(),
                                LastLogged            = Convert.ToDateTime(dtCompanyInfo.Rows[iRow]["LastLogged"].ToString()),
                                LoginBeforeLastLogged = Convert.ToDateTime(dtCompanyInfo.Rows[iRow]["LoginBeforeLastLogged"].ToString())
                            });
                        }
                    }
                    return(oResult);
                }
            }
            catch (Exception ex)
            {
                oResult.Add(new CCompany()
                {
                    Success       = false,
                    WasSuccessful = 0,
                    Exception     = ex.Message
                });
                return(oResult);
            }
        }
        public CGeneralUser Login(string UserName, string PassWord)
        {
            CGeneralUser oResult = new CGeneralUser();

            try
            {
                string  ePassword = _sqlService.GetEncryptString(PassWord);
                DataSet dsLogin   = _sqlService.GetDataSet("TLogin", "uspLogin '" + UserName + "', '" + ePassword + "'");
                using (DataTable dtLogin = dsLogin.Tables["TLogin"])
                {
                    if (dtLogin != null && dtLogin.Rows.Count > 0)
                    {
                        if (Convert.ToBoolean(dtLogin.Rows[0]["Success"]))
                        {
                            // TRUE FOR ORGANIZATION
                            oResult.DisplayName   = dtLogin.Rows[0]["DisplayName"].ToString();
                            oResult.UserID        = Convert.ToInt32(dtLogin.Rows[0]["UserID"]);
                            oResult.LoginTypeCode = Convert.ToInt32(dtLogin.Rows[0]["LoginTypeCode"]);
                            oResult.LastLogged    = Convert.ToDateTime(dtLogin.Rows[0]["LastLogged"]);
                            oResult.Success       = Convert.ToBoolean(dtLogin.Rows[0]["Success"]);
                            oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]);
                            oResult.Exception     = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString();
                        }
                        // FAILED TO LOGIN
                        else
                        {
                            oResult.Success       = Convert.ToBoolean(dtLogin.Rows[0]["Success"]);
                            oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]);
                            oResult.Exception     = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                oResult.Success       = false;
                oResult.WasSuccessful = 0;
                oResult.Exception     = ex.Message;
            }
            return(oResult);
        }
        public List <COrnamentsPosition> OrnamentsPositionDetailList()
        {
            List <COrnamentsPosition> oResult = new List <COrnamentsPosition>();

            try
            {
                // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET
                DataSet dsOrnamentsPositionInfo = _sqlService.GetDataSet("TOrnamentsPositionInfo", "uspOrnamentsPositionInfoGet 0");

                using (DataTable dtOrnamentsPositionInfo = dsOrnamentsPositionInfo.Tables["TOrnamentsPositionInfo"])
                {
                    if (dtOrnamentsPositionInfo.Rows.Count > 0)
                    {
                        for (int iRow = 0; iRow <= dtOrnamentsPositionInfo.Rows.Count - 1; iRow++)
                        {
                            // SET THE DATASET INFORMATION TO THE RETURN VALUE
                            oResult.Add(new COrnamentsPosition()
                            {
                                CategoryID         = Convert.ToInt32(dtOrnamentsPositionInfo.Rows[iRow]["CategoryID"].ToString()),
                                OrnamentPositionID = Convert.ToInt32(dtOrnamentsPositionInfo.Rows[iRow]["PositionID"].ToString()),
                                Name         = dtOrnamentsPositionInfo.Rows[iRow]["Name"].ToString(),
                                CategoryName = dtOrnamentsPositionInfo.Rows[iRow]["CategoryName"].ToString(),
                                Description  = dtOrnamentsPositionInfo.Rows[iRow]["Description"].ToString(),
                                ImgPath      = _sqlService.ImagePathGet(dtOrnamentsPositionInfo.Rows[iRow]["LogoImage"].ToString(), 0, string.Empty)
                            });
                        }
                    }
                    return(oResult);
                }
            }
            catch (Exception ex)
            {
                oResult.Add(new COrnamentsPosition()
                {
                    Success       = false,
                    WasSuccessful = 0,
                    Exception     = ex.Message
                });
                return(oResult);
            }
        }
        public List <COrnaments> OrnamentsDetailList()
        {
            List <COrnaments> oResult = new List <COrnaments>();
            List <string>     images  = new List <string>();

            try
            {
                // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET
                DataSet dsOrnamentsInfo = _sqlService.GetDataSet("TOrnamentsInfo,TImages", "uspOrnamentsInfoGet 0");

                using (DataTable dtOrnamentsInfo = dsOrnamentsInfo.Tables["TOrnamentsInfo"])
                {
                    if (dtOrnamentsInfo.Rows.Count > 0)
                    {
                        for (int iRow = 0; iRow <= dtOrnamentsInfo.Rows.Count - 1; iRow++)
                        {
                            images = new List <string>();
                            int ornamentID = Convert.ToInt32(dtOrnamentsInfo.Rows[iRow]["OrnamentID"].ToString());
                            using (DataTable dtImagesInfo = dsOrnamentsInfo.Tables["TImages"])
                            {
                                if (dtImagesInfo.Rows.Count > 0)
                                {
                                    for (int jRow = 0; jRow <= dtImagesInfo.Rows.Count - 1; jRow++)
                                    {
                                        int imgOrnamnetID = Convert.ToInt32(dtImagesInfo.Rows[jRow]["OrnamentID"].ToString());
                                        if (ornamentID == imgOrnamnetID)
                                        {
                                            images.Add(_sqlService.ImagePathGet(dtImagesInfo.Rows[jRow]["ImgPath"].ToString(), 0, string.Empty));
                                        }
                                    }
                                }
                            }
                            // SET THE DATASET INFORMATION TO THE RETURN VALUE
                            oResult.Add(new COrnaments()
                            {
                                CategoryID         = Convert.ToInt32(dtOrnamentsInfo.Rows[iRow]["CategoryID"].ToString()),
                                OrnamentPositionID = Convert.ToInt32(dtOrnamentsInfo.Rows[iRow]["PositionID"].ToString()),
                                OrnamentID         = Convert.ToInt32(dtOrnamentsInfo.Rows[iRow]["OrnamentID"].ToString()),
                                Name                 = dtOrnamentsInfo.Rows[iRow]["Name"].ToString(),
                                CategoryName         = dtOrnamentsInfo.Rows[iRow]["CategoryName"].ToString(),
                                Description          = dtOrnamentsInfo.Rows[iRow]["Description"].ToString(),
                                OrnamentPositionName = dtOrnamentsInfo.Rows[iRow]["PositionName"].ToString(),
                                Weight               = dtOrnamentsInfo.Rows[iRow]["Weight"].ToString(),
                                Cost                 = Convert.ToDecimal(dtOrnamentsInfo.Rows[iRow]["Cost"].ToString()),
                                OrnamentsImgPath     = images
                            });
                        }
                    }
                    return(oResult);
                }
            }
            catch (Exception ex)
            {
                oResult.Add(new COrnaments()
                {
                    Success       = false,
                    WasSuccessful = 0,
                    Exception     = ex.Message
                });
                return(oResult);
            }
        }