public static bool DoLogin(string userId, string password, string macId, out string msg)
        {
            bool isSuccess;

            DBoperationsManager.DoLogin(userId, password, macId, out msg, out isSuccess);
            return(isSuccess);
        }
        public static RationCardDetail FetchFamilyCount(string custId)
        {
            ErrorEnum        errType      = ErrorEnum.Other;
            string           errMsg       = string.Empty;
            bool             isSuccess    = false;
            Exception        errObj       = new Exception();
            int              convertedNum = 0;
            RationCardDetail card         = new RationCardDetail();

            try
            {
                DataSet ds = DBoperationsManager.FetchFamilyCount(custId, out errType, out errMsg, out isSuccess, out errObj);

                if ((ds != null) && (ds.Tables.Count > 1))
                {
                    card.FamilyCount = (( //TOTAL_CARD_COUNT
                                            (ds.Tables[0].Rows.Count > 0) && Int32.TryParse(ds.Tables[0].Rows[0][0].ToString(), out convertedNum))
                        ? convertedNum : 0).ToString();
                    card.CardCount = (( //Active_CARD_COUNT
                                          (ds.Tables[1].Rows.Count > 0) && Int32.TryParse(ds.Tables[1].Rows[0][0].ToString(), out convertedNum))
                        ? convertedNum : 0).ToString();
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
            return(card);
        }
        public static void FetchConfig(string distId = "", string keyText = "", string keyVal = "", int active = 1, string operation = "GET", string cloneFromDistId = "")
        {
            ErrorEnum errType   = ErrorEnum.Other;
            string    errMsg    = string.Empty;
            bool      isSuccess = false;
            Exception errObj    = new Exception();

            isSuccess = false;

            distId = (string.IsNullOrEmpty(distId.Trim())) ? RationCardUser.DistId : distId;
            if (operation == "CLONE")
            {
                cloneFromDistId = (string.IsNullOrEmpty(cloneFromDistId.Trim())) ? RationCardUser.DistId : cloneFromDistId;
            }
            try
            {
                DataSet ds = DBoperationsManager.FetchConfig(out errType, out errMsg, out isSuccess, out errObj);

                if ((ds != null) && (ds.Tables.Count > 0))
                {
                    AssignConfigData(ds);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
Beispiel #4
0
        public JsonResult DuplicateCheck(string val, string checkBy)
        {
            bool      isUnique = false;
            string    finalMsg = string.Empty;
            Exception errObj   = new Exception();

            DBoperationsManager.DuplicateCheck(val, checkBy, out finalMsg);
            return(new JsonResult(new { isUnique = isUnique, finalMsg = finalMsg }));
        }
 public static void RemoveUser(string userId, out bool isSuccess)
 {
     isSuccess = false;
     try
     {
         DBoperationsManager.RemoveUser(userId, out isSuccess);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
        public static void ApplicationStartDbFetch()
        {
            ErrorEnum errType   = ErrorEnum.Other;
            string    errMsg    = string.Empty;
            bool      isSuccess = false;
            Exception errObj    = new Exception();

            try
            {
                DBoperationsManager.ApplicationStartDbFetch(out errType, out errMsg, out isSuccess);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
        public static void RegisterNewUser(string name, string mobileNo, string address, string email, string profilePicPath
                                           , string login, string password, bool macChekRequired, string fpsCode, string fpsLiscenceNo, string mrShopNo
                                           , string mac, string remark, string code
                                           , out string successMsg)
        {
            List <MacIdAssigned> mcs = new List <MacIdAssigned>();

            successMsg = "";
            try
            {
                DBoperationsManager.RegisterNewUser(name, mobileNo, address, email, profilePicPath
                                                    , login, password, macChekRequired, fpsCode, fpsLiscenceNo, mrShopNo
                                                    , mac, remark, code
                                                    , out successMsg);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
        public static void FetchDistributorData()
        {
            ErrorEnum errType   = ErrorEnum.Other;
            string    errMsg    = string.Empty;
            bool      isSuccess = false;
            Exception errObj    = new Exception();

            try
            {
                DataSet ds = DBoperationsManager.FetchDistributorData(out errType, out errMsg, out isSuccess, out errObj);

                if ((ds != null) && (ds.Tables.Count > 0))
                {
                    AssignDistributorData(ds);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
        public static CategoryWiseSearchResult SearchCard(string searchBy, string searchText, string searchCatId, bool fetchOnlyRecentData = false)
        {
            ErrorEnum errType      = ErrorEnum.Other;
            string    errMsg       = string.Empty;
            bool      isSuccess    = false;
            Exception errObj       = new Exception();
            int       convertedNum = 0;
            var       result       = new CategoryWiseSearchResult();

            result.CardSearchResult = new List <RationCardDetail>();
            try
            {
                DataSet ds = DBoperationsManager.SearchCard(searchBy, searchText, searchCatId, out errType, out errMsg, out isSuccess, out errObj);

                if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
                {
                    int count = 1;
                    result.CardCountOfCategory = int.TryParse(ds.Tables[1].Rows[0]["RECORD_COUNT"].ToString(), out convertedNum) ? convertedNum : 0;
                    result.CategoryOfCard      = MasterData.Categories.Data.FirstOrDefault(i => i.Cat_Id == searchCatId);
                    foreach (DataRow r in ds.Tables[0].Rows)
                    {
                        result.CardSearchResult.Add(new RationCardDetail
                        {
                            SlNo              = count,
                            Number            = r["RATIONCARD_NO"].ToString(),
                            Adhar_No          = r["Adhar_No"].ToString(),
                            Mobile_No         = r["Mobile_No"].ToString(),
                            Hof_Name          = r["HOF_NAME"].ToString(),
                            Name              = r["Name"].ToString(),
                            Age               = r["Age"].ToString(),
                            Address           = r["Address"].ToString(),
                            CardStatus        = (r["STATUS"].ToString() == "True") ? "Active" : "",
                            ActiveCard        = r["STATUS"].ToString() == "True",
                            Card_Created_Date = r["Created_Date"].ToString(),
                            Cat_Desc          = r["Cat_Desc"].ToString(),
                            Customer_Id       = r["Customer_Id"].ToString(),
                            Hof_Flag          = r["Hof_Flag"].ToString(),
                            Hof_Id            = r["Hof_Id"].ToString(),
                            RationCard_Id     = r["RationCard_Id"].ToString(),
                            Cat_Id            = r["Cat_Id"].ToString(),
                            Card_Category_Id  = r["Cat_Id"].ToString(),
                            Remarks           = r["Remarks"].ToString(),
                            Relation_With_Hof = r["Relation_With_Hof"].ToString(),
                            Gaurdian_Relation = r["Gaurdian_Relation"].ToString(),
                            Gaurdian_Name     = r["Gaurdian_Name"].ToString(),
                            FamilyCount       = ds.Tables[0].AsEnumerable().Count(
                                i => i["Hof_Id"].ToString() == r["Hof_Id"].ToString()).ToString(),
                            CardCount = ds.Tables[0].AsEnumerable().Count(
                                i => i["Hof_Id"].ToString() == r["Hof_Id"].ToString() &&
                                (r["STATUS"].ToString() == "True")).ToString()
                        });
                        count++;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
            return(result);
        }
        public static void FetchMasterData()
        {
            ErrorEnum errType   = ErrorEnum.Other;
            string    errMsg    = string.Empty;
            bool      isSuccess = false;
            Exception errObj    = new Exception();

            try
            {
                DataSet ds = DBoperationsManager.FetchMasterData(out errType, out errMsg, out isSuccess, out errObj);

                DataSet tmpDs = new DataSet();
                if ((ds != null) && (ds.Tables.Count > 0))
                {
                    tmpDs.Tables.Add(ds.Tables[0].Copy());
                    tmpDs.Tables.Add(ds.Tables[1].Copy());
                    tmpDs.Tables.Add(ds.Tables[2].Copy());
                    AssignHofData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[3].Copy());
                    AssignCategoryData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[4].Copy());
                    AssignRelationData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[5].Copy());
                    tmpDs.Tables.Add(ds.Tables[6].Copy());
                    tmpDs.Tables.Add(ds.Tables[7].Copy());
                    tmpDs.Tables.Add(ds.Tables[8].Copy());
                    AssignProductData(tmpDs);
                    tmpDs.Reset();


                    tmpDs.Tables.Add(ds.Tables[9].Copy());
                    tmpDs.Tables.Add(ds.Tables[10].Copy());
                    AssignUomData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[11].Copy());
                    AssignProductDeptData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[12].Copy());
                    AssignProductSubDeptData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[13].Copy());
                    AssignProductClassData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[14].Copy());
                    AssignProductSubClassData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[15].Copy());
                    AssignProductMcData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[16].Copy());
                    AssignProductBrandData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[17].Copy());
                    AssignRoleData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[18].Copy());
                    tmpDs.Tables.Add(ds.Tables[19].Copy());
                    AssignDistributorData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[20].Copy());
                    AssignConfigData(tmpDs);
                    tmpDs.Reset();

                    tmpDs.Tables.Add(ds.Tables[21].Copy());
                    AssignCardsOfThisFortnight(tmpDs);
                    tmpDs.Reset();

                    //DataFetchTime
                    MasterData.DataFetchTime = DateTime.Now;
                    MasterDataHelper.FetchCategoryWiseSearchResult();
                }
                Logger.LogInfo(Environment.NewLine + "masterdata fetch completed on " + DateTime.Now);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }