Exemplo n.º 1
0
        public AD_ClientContacts Single(string filter, string value = null)
        {
            try
            {
                DataTable         dt      = cd.Get(filter, value);
                AD_ClientContacts Contact = new AD_ClientContacts();

                if (dt != null && dt.Rows.Count > 0)
                {
                    int i = 0;
                    Contact.ContactId     = int.Parse(dt.Rows[i]["ContactId"].ToString());
                    Contact.ContactPerson = dt.Rows[i]["ContactPerson"].ToString();
                    Contact.Designation   = dt.Rows[i]["Designation"].ToString();
                    Contact.Gender        = dt.Rows[i]["Gender"].ToString();
                    Contact.Title         = dt.Rows[i]["Title"].ToString();
                    Contact.ContactNo     = int.Parse(dt.Rows[i]["ContactNo"].ToString());
                    Contact.ContactType   = dt.Rows[i]["ContactType"].ToString();
                    Contact.IsPrimary     = bool.Parse(dt.Rows[i]["IsPrimary"].ToString());
                    Contact.ClientId      = int.Parse(dt.Rows[i]["ClientId"].ToString());
                    Contact.UserId        = int.Parse(dt.Rows[i]["UserId"].ToString());
                    Contact.RegionId      = int.Parse(dt.Rows[i]["RegionId"].ToString());
                    Contact.ContactCityId = int.Parse(dt.Rows[i]["CityId"].ToString());
                    Contact.IsActive      = bool.Parse(dt.Rows[i]["IsActive"].ToString());
                    Contact.ReportToId    = int.TryParse(dt.Rows[i]["ReportToId"].ToString(), out i) ? (int?)i : null;

                    return(Contact);
                }
                return(null);
            }
            catch (Exception ex) {
                return(null);
            }
        }
Exemplo n.º 2
0
 public ActionResult Contact(int Id)
 {
     try
     {
         ViewBag.Count = 0;
         SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
         ViewBag.SelectedPClient = sl.Clients("All");
         ViewBag.Users           = sl.Users("UserAll");
         ViewBag.Regions         = sl.RegionWithParent("RegionParent");
         ViewBag.Cities          = sl.Definations("Cities");
         ViewBag.Reports         = sl.ClientContacts("AllActive");
         AD_ClientContactsBL con     = new AD_ClientContactsBL();
         AD_ClientContacts   Contact = con.Single("ById", Id.ToString());
         if (Id != 0)
         {
             List <AD_ClientContacts> Contacts = con.ToList("ById", Id.ToString());
             if (Contacts.Count > 0)
             {
                 Contact.Client = Contacts;
                 ViewBag.Count  = Contacts.Count;
             }
         }
         return(PartialView("~/Views/Client/_ClientContact.cshtml", Contact));
     }
     catch (Exception ex)
     {
         return(PartialView("~/Views/Client/_ClientContact.cshtml", null));
     }
 }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 5
0
 public int Manage(string filter, AD_ClientContacts cl, DataTable Table)
 {
     return(cd.Manage(filter, cl.ContactId, cl.ContactPerson, cl.Designation, cl.Gender, cl.Title, cl.ContactNo, cl.ContactType, cl.IsPrimary, cl.ClientId, cl.UserId, cl.RegionId, cl.ContactCityId, cl.IsActive, cl.ReportToId, Table));
 }