Exemple #1
0
        public AD_ClientAddress Single(string filter, string value = null)
        {
            try
            {
                DataTable        dt     = cd.Get(filter, value);
                AD_ClientAddress Addres = new AD_ClientAddress();

                if (dt != null && dt.Rows.Count > 0)
                {
                    int i = 0;
                    Addres.AddressId     = int.Parse(dt.Rows[i]["AddressId"].ToString());
                    Addres.Address       = dt.Rows[i]["Address"].ToString();
                    Addres.Street        = dt.Rows[i]["Street"].ToString();
                    Addres.AddressCityId = int.Parse(dt.Rows[i]["CityId"].ToString());
                    Addres.StateId       = int.Parse(dt.Rows[i]["StateId"].ToString());
                    Addres.CountryId     = int.Parse(dt.Rows[i]["CountryId"].ToString());
                    Addres.ZipCode       = int.Parse(dt.Rows[i]["ZipCode"].ToString());
                    Addres.IsHeadOffice  = bool.Parse(dt.Rows[i]["IsHeadOffice"].ToString());
                    Addres.ClientId      = int.Parse(dt.Rows[i]["ClientId"].ToString());
                    Addres.IsActive      = bool.Parse(dt.Rows[i]["IsActive"].ToString());

                    return(Addres);
                }
                return(null);
            }
            catch (Exception) {
                return(null);
            }
        }
Exemple #2
0
        public ActionResult Address(int Id)
        {
            try
            {
                ViewBag.Count = 0;
                SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
                ViewBag.SelectedCountry = sl.Definations("Countries");
                ViewBag.SelectedState   = sl.Definations("States");
                ViewBag.Cities          = sl.Definations("Cities");
                ViewBag.SelectedPClient = sl.Clients("All");

                AD_ClientAddressBL adress  = new AD_ClientAddressBL();
                AD_ClientAddress   Address = adress.Single("ById", Id.ToString());
                if (Id != 0)
                {
                    List <AD_ClientAddress> Addresses = adress.ToList("ById", Id.ToString());
                    if (Addresses.Count > 0)
                    {
                        Address.Addresses = Addresses;
                        ViewBag.Count     = Addresses.Count;
                    }
                }
                return(PartialView("~/Views/Client/_ClientAddress.cshtml", Address));
            }
            catch (Exception ex)
            {
                return(PartialView("~/Views/Client/_ClientAddress.cshtml", null));
            }
        }
Exemple #3
0
        public ActionResult NewSingle(AD_Clients cl, AD_ClientContacts con, AD_ClientAddress claddress)
        {
            Response res = new Response();

            try
            {
                AD_ClientContactsBL clcon     = new AD_ClientContactsBL();
                AD_ClientAddressBL  addressbl = new AD_ClientAddressBL();

                int ClientId  = 0;
                int ContactId = 0;
                int AddressId = 0;
                if (cl.ClientId > 0 || con.ContactId > 0 || claddress.AddressId > 0)
                {
                    ClientId    = BL.Manage("Update", cl);
                    ContactId   = clcon.Manage("Update", con, null);
                    AddressId   = addressbl.Manage("Update", claddress);
                    res.Status  = "success";
                    res.Message = "update successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    //if (Request.Files != null && Request.Files.Count > 0)
                    //{

                    //    foreach (string f in Request.Files)
                    //    {
                    //        HttpPostedFileBase file = Request.Files[f];
                    //        if (file.FileName == "")
                    //        {
                    //            cl.Logo = "";
                    //        }
                    //        else
                    //        {
                    //            string webpath = "/Content/Images/ClientLogo/"+ cl.ClientName + file.FileName.Substring(file.FileName.LastIndexOf("."));
                    //            file.SaveAs(Request.MapPath(webpath));
                    //            cl.Logo = webpath;

                    //        }
                    //    }
                    //}

                    ClientId           = BL.Manage("Insert", cl);
                    con.ClientId       = ClientId;
                    ContactId          = clcon.Manage("Insert", con, null);
                    claddress.ClientId = ClientId;
                    AddressId          = addressbl.Manage("Insert", claddress);
                    res.Status         = "success";
                    res.Message        = "save successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #4
0
        public ActionResult NewSingle(AD_Clients cl, AD_ClientContacts con, AD_ClientAddress claddress)
        {
            Response res = new Response();

            try
            {
                ClientsBL           rb        = new ClientsBL();
                AD_ClientContactsBL clcon     = new AD_ClientContactsBL();
                AD_ClientAddressBL  addressbl = new AD_ClientAddressBL();

                int ClientId  = 0;
                int ContactId = 0;
                int AddressId = 0;
                if (cl.ClientId > 0 || con.ContactId > 0 || claddress.AddressId > 0)
                {
                    ClientId    = rb.Manage("Update", cl);
                    ContactId   = clcon.Manage("Update", con, null);
                    AddressId   = addressbl.Manage("Update", claddress);
                    res.Status  = "success";
                    res.Message = "update successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ClientId           = rb.Manage("Insert", cl);
                    con.ClientId       = ClientId;
                    ContactId          = clcon.Manage("Insert", con, null);
                    claddress.ClientId = ClientId;
                    AddressId          = addressbl.Manage("Insert", claddress);
                    res.Status         = "success";
                    res.Message        = "save successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #5
0
 public int Manage(string filter, AD_ClientAddress cl)
 {
     return(cd.Manage(filter, cl.AddressId, cl.Address, cl.Street, cl.AddressCityId, cl.StateId, cl.CountryId, cl.ZipCode, cl.IsHeadOffice, cl.ClientId, cl.IsActive));
 }