public string UpdatePartyData(string PtCode, string Ptname, string MoNo, string Email, string Add, string Stcode = "", string CtCode = "", string area = "", string DrName = "", string DrCode = "")
 {
     try
     {
         using (GBCDbConn con = new GBCDbConn())
         {
             //string pcode = GenrateCode(name);
             //ACPMST_temp obj = new ACPMST_temp();
             ACPMST_temp obj = con.ACPMST_temp.SingleOrDefault(p => p.PtCode == PtCode);
             obj.Address = Add;
             obj.Email   = Email;
             obj.PhNo    = MoNo;
             obj.PtName  = Ptname;
             //obj.PtCode = pcode;
             //obj.RegDate = DateTime.Now.Date;
             //obj.DeviceId = deviceId;
             obj.StCode = Stcode;
             obj.CtCode = CtCode;
             obj.Area   = area;
             // obj.FDocCode = DrCode;
             //obj.FDocName = DrName;
             // con.DB_Acc_Temp.Add(obj);
             con.SaveChanges();
             return("");
         }
     }
     catch (Exception ex)
     {
         return("$" + ex.Message + ex.InnerException.Message);
     }
 }
        public string checkparty(string PtCode)
        {
            try
            {
                GBCDbConn con = new GBCDbConn();

                ACPMST      obj1  = con.Db_acpmst.SingleOrDefault(p => p.PCODE == PtCode);
                ACPMST_temp obj_C = con.ACPMST_temp.SingleOrDefault(p => p.PtCode == PtCode);
                if (obj1 == null)
                {
                    if (obj_C == null)
                    {
                        return("0");
                    }
                    else
                    {
                        GBCCon     con1 = new GBCCon();
                        ServiceReg obj  = con1.db_SerReg.SingleOrDefault(p => p.Pcode == obj_C.PCODE);
                        if (obj == null)
                        {
                            return(obj_C.ServicePath + "|" + "" + "|" + "" + "|" + obj_C.PtName + "|" + obj_C.PtCode + "|" + obj_C.PhNo + "|" + obj_C.Email + "|" + obj_C.Address + "|" + obj_C.DeviceId + "|" + obj_C.StCode + "|" + obj_C.CtCode + "|" + obj_C.Area + "|" + "|" + obj_C.PREPTCODE + "|");
                        }
                        else
                        {
                            return(obj_C.ServicePath + "|" + obj.Name + "|" + obj.Pcode + "|" + obj_C.PtName + "|" + obj_C.PtCode + "|" + obj_C.PhNo + "|" + obj_C.Email + "|" + obj_C.Address + "|" + obj_C.DeviceId + "|" + obj_C.StCode + "|" + obj_C.CtCode + "|" + obj_C.Area + "|" + "|" + obj_C.PREPTCODE + "|");
                        }
                    }
                }

                else
                {
                    GBCCon     con1 = new GBCCon();
                    ServiceReg obj  = con1.db_SerReg.SingleOrDefault(p => p.Pcode == obj_C.PCODE);
                    if (obj == null)
                    {
                        return(obj_C.ServicePath + "|" + "" + "|" + "" + "|" + obj_C.PtName + "|" + obj1.PCODE + "|" + obj_C.PhNo + "|" + obj_C.Email + "|" + obj_C.Address + "|" + obj_C.DeviceId + "|" + obj_C.StCode + "|" + obj_C.CtCode + "|" + obj_C.Area + "|" + "|" + "|" + obj_C.PREPTCODE + "|");
                    }
                    else
                    {
                        return(obj_C.ServicePath + "|" + obj.Name + "|" + obj.Pcode + "|" + obj_C.PtName + "|" + obj1.PCODE + "|" + obj_C.PhNo + "|" + obj_C.Email + "|" + obj_C.Address + "|" + obj_C.DeviceId + "|" + obj_C.StCode + "|" + obj_C.CtCode + "|" + obj_C.Area + "|" + "|" + "|" + obj_C.PREPTCODE + "|");
                        //return obj_C.ServicePath + "|" + obj.Name + "|" + obj.Pcode + "|" + obj1.ConsumerMob + "|";
                    }
                }
            }
            catch (Exception ex)
            {
                return("$" + ex.Message);
            }
        }
        public string getDataFromRegCode1(string code)
        {
            GBCDbConn          gbc_con = new GBCDbConn();
            List <ACPMST_temp> obj     = gbc_con.ACPMST_temp.Where(p => p.PtCode == code).ToList();

            if (obj.Count != 0)
            {
                ACPMST_temp o = obj.Take(1).SingleOrDefault();
                return(o.PtName + "<|>" + o.Address + "<|>" + o.PtCode + "<|>" + o.PhNo);
            }
            else
            {
                return("");
            }
        }
        public string getDataFromMobno(string MobNo)
        {
            //GBCCon gbc_con = new GBCCon();
            GBCDbConn          gbc_con = new GBCDbConn();
            List <ACPMST_temp> obj     = gbc_con.ACPMST_temp.Where(p => p.PhNo == MobNo).ToList();

            if (obj.Count != 0)
            {
                ACPMST_temp o = obj.Take(1).SingleOrDefault();
                return(o.PtName + "<|>" + o.Address + "<|>" + o.PtCode);
            }
            else
            {
                return("");
            }
        }
        public string RegisterCustmoer(string name, string Add, string email, string phone, string Pass, string AppType, string PCODE, string Stcode = "", string CtCode = "", string area = "", string deviceId = "", string DrName = "", string DrCode = "")
        {
            try
            {
                using (GBCDbConn con = new GBCDbConn())
                {
                    string      pcode = GenrateCode(name);
                    ACPMST_temp obj   = new ACPMST_temp();
                    obj.Address  = Add;
                    obj.Email    = email;
                    obj.PhNo     = phone;
                    obj.PtName   = name;
                    obj.PtCode   = pcode;
                    obj.RegDate  = DateTime.Now.Date;
                    obj.DeviceId = deviceId;
                    obj.StCode   = Stcode;
                    obj.CtCode   = CtCode;
                    obj.Area     = area;
                    obj.PCODE    = PCODE;

                    // obj.FDocCode = DrCode;
                    //obj.FDocName = DrName;
                    con.ACPMST_temp.Add(obj);
                    con.SaveChanges();
                    string msg = "Welcome To TiaER@App!\n Your UserId/Registration Code :" + pcode;
                    if (AppType == "$")
                    {
                        msg = "Welcome!\n Your UserId/Registration Code :" + pcode;
                    }
                    // GetSMSUrl(phone, msg, AppType, PCODE);
                    return(pcode);
                }
            }
            catch (Exception ex)
            {
                return("$" + ex.Message + ex.InnerException.Message);
            }
        }