Exemplo n.º 1
0
        public static void SaveUserPages(int userid, string pages)
        {
            CBDB db   = new CBDB();
            var  user = db.Tbl_User_Detail.Where(x => x.ID == userid).FirstOrDefault();

            user.GroupPages = pages;
            db.SaveChanges();
        }
        public static void MachineLogout(string MName)
        {
            try
            {
                // WriteToLogFile.writeMessage("MachineLogout Method [Started]");
                using (CBDB db = new CBDB())
                {
                    var obj = db.tbl_MachineInfo.Where(x => x.MachineName.Equals(MName)).FirstOrDefault();

                    obj.IsActive = false;
                    db.SaveChanges();
                }
                // WriteToLogFile.writeMessage("MachineLogout Method [Ended] successfully");
            }
            catch (Exception Ex)
            {
                //WriteToLogFile.writeMessage("MachineLogout Method [Ended] UNsuccessfully Error = " +Ex.Message.ToString());
                throw Ex;
            }
        }
        public static Tbl_User_Detail SaveUser(Tbl_User_Detail obj)
        {
            Tbl_User_Detail tbl = new Tbl_User_Detail();

            using (CBDB db = new CBDB())
            {
                tbl = db.Tbl_User_Detail.Where(x => x.UserName.Equals(obj.UserName)).FirstOrDefault();
                if (tbl == null)
                {
                    if (obj.Usergroup.ToLower().Contains("admin"))
                    {
                        obj.GroupPages = "CaseStat ,WCStat ,SLA ,CaseHistory ,CaseClosure ,MtchedTran ,UnmtchedTran ,Recon,RobotConfig";
                    }
                    else
                    {
                        obj.GroupPages = "CaseStat ,WCStat ,SLA ,CaseHistory ,CaseClosure ,MtchedTran ,UnmtchedTran ,Recon";
                    }
                    db.Tbl_User_Detail.Add(obj);
                    db.SaveChanges();
                    tbl = obj;
                }
            }
            return(tbl);
        }
Exemplo n.º 4
0
        public static void AddRow_NonCustom_GLReconciliationTable(NonCustom_GLReconciliationTable obj)
        {
            NonCustom_GLReconciliationTable addObj = new NonCustom_GLReconciliationTable();

            if (obj != null)
            {
                CBDB db = new CBDB();
                CaseStatisticsDataLayer objdata = new CaseStatisticsDataLayer();

                addObj.ValueDate  = obj.ValueDate;
                addObj.PostDate   = obj.PostDate;
                addObj.MemberCase = obj.MemberCase;
                addObj.Name       = obj.Name;
                addObj.Reference  = obj.CardNumber;
                addObj.Credit     = obj.Credit;
                addObj.Debit      = obj.Debit;

                addObj.IsActive = true;


                db.NonCustom_GLReconciliationTable.Add(addObj);
                db.SaveChanges();
            }
        }
        public static bool CheckMachine(string Machine)
        {
            if ((String.IsNullOrEmpty(Machine)))
            {
                WriteToLogFile.writeMessage("Machine Name Received null");
            }


            bool Check = false;

            try
            {
                //WriteToLogFile.writeMessage("Check Machine [Started]");

                using (CBDB db = new CBDB())
                {
                    //WriteToLogFile.writeMessage("Connection With DB Created");
                    var mobj = db.tbl_MachineInfo.Where(x => x.MachineName.Equals(Machine)).FirstOrDefault();

                    if (mobj == null)
                    {
                        //WriteToLogFile.writeMessage("No machine is present with this name");
                        //WriteToLogFile.writeMessage("Creating New Machine Entry in DB");
                        tbl_MachineInfo obj = new tbl_MachineInfo();
                        obj.MachineName = Machine;
                        obj.CreatedTs   = DateTime.Now;
                        obj.IsActive    = true;
                        ///WriteToLogFile.writeMessage("Adding Entry in Table");
                        db.tbl_MachineInfo.Add(obj);
                        // WriteToLogFile.writeMessage("Entry Added Successfully in Table");
                        db.SaveChanges();
                        //WriteToLogFile.writeMessage("Changes Saved Successfully");
                        Check = true;
                    }
                    else if (mobj.IsActive == false)
                    {
                        // WriteToLogFile.writeMessage("Machine Already present but with is asctive as false");
                        mobj.IsActive  = true;
                        mobj.CreatedTs = DateTime.Now;
                        //WriteToLogFile.writeMessage("Saving Changes to DB");
                        db.SaveChanges();
                        //WriteToLogFile.writeMessage("Changes Saved Successfully");
                        Check = true;
                    }
                    else
                    {
                        //WriteToLogFile.writeMessage("Machine Already present and with is asctive as True");
                        //WriteToLogFile.writeMessage("Checking Time Difference");
                        int TimeDiff = Convert.ToInt32(ConfigurationManager.AppSettings["TimeDiff"].ToString());
                        //WriteToLogFile.writeMessage("Time Diff = "+TimeDiff.ToString());
                        int diff = (DateTime.Now - Convert.ToDateTime(mobj.CreatedTs)).Minutes;
                        ///WriteToLogFile.writeMessage("diff in minutes "+diff.ToString());
                        if (diff >= TimeDiff)
                        {
                            // WriteToLogFile.writeMessage("Machine Time out reached to maximun updating is active to true");
                            mobj.IsActive  = true;
                            mobj.CreatedTs = DateTime.Now;
                            //WriteToLogFile.writeMessage("Saving Changes to DB");
                            db.SaveChanges();
                            //WriteToLogFile.writeMessage("Changes Saved Successfully");
                            Check = true;
                        }
                        else
                        {
                            // WriteToLogFile.writeMessage("Cannot activate machine because time out not reached");
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                //throw Ex;
                // WriteToLogFile.writeMessage("Exception Occured While processing this method exception msg = " + Ex.Message.ToString());
            }
            //WriteToLogFile.writeMessage("Returned Check Value "+Check.ToString());
            return(Check);
        }