示例#1
0
 public JsonResult AddClient(Client objAddClient, string ClientIDHdn)
 {
     try
     {
         if (ClientIDHdn != null && ClientIDHdn != "")
         {
             int     id        = Convert.ToInt32(ClientIDHdn);
             cClient objClient = cClient.Get_ID(id);
             objClient.sName        = objAddClient.ClientName;
             objClient.sEmailID     = objAddClient.EmailIDUpdate;
             objClient.sContactNo   = objAddClient.ContactUpdate;
             objClient.sAddress     = objAddClient.Address;
             objClient.sDescription = objAddClient.Description;
             objClient.Save();
             return(Json("2"));
         }
         else
         {
             cClient objClient = cClient.Create();
             objClient.sName        = objAddClient.ClientName;
             objClient.sEmailID     = objAddClient.EmailID;
             objClient.sContactNo   = objAddClient.Contact;
             objClient.sAddress     = objAddClient.Address;
             objClient.sDescription = objAddClient.Description;
             objClient.Save();
             return(Json("3"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        /// <summary>
        /// Creates a cClient object. It will be saved in permanent storage only
        /// on calling Save()
        /// </summary>
        /// <returns>cClient object</returns>
        public static cClient Create()
        {
            cClient oObj = new cClient();

            SecurityCheck((int)enClient_Action.Create);

            // Create an object in memory, will be saved to storage on calling Save()
            oObj.m_bCreating = true;
            oObj.m_bInvalid  = false;
            return(oObj);
        }
        // GET: EditUser
        public ActionResult Index()
        {
            if(Session["UserID"] == null)
            {
               return this.Redirect(Url.Action("Index", "Home"));
            }
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            cClient client = sr.getClient(Convert.ToInt32(Session["UserID"]));
            return View(client);

        }
示例#4
0
        /// <summary>
        /// Ensures that an object with the specified name exists, while creating other properties are set to their default values
        /// </summary>
        /// <param name="i_sName">Name</param>
        /// <returns>cClient object</returns>
        public static cClient CreateIfRequiredAndGet(string i_sName)
        {
            cClient oObj = cClient.Get_Name(i_sName);

            if (oObj == null)
            {
                oObj       = cClient.Create();
                oObj.sName = i_sName;
                oObj.Save();
            }
            return(oObj);
        }
        public ActionResult ChangeUser(cClient client)
        {
            if (Session["UserID"] == null)
            {
               return this.Redirect(Url.Action("Index", "Home"));
            }

            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            bool isEditied = sr.editClient(client);
            if (isEditied)
            {
                return View();
            }
            else
            {
                return this.Redirect(Url.Action("Index", "EditUser"));
            }

        }
示例#6
0
 public ActionResult AddClient(string ID)
 {
     try
     {
         Client objModelClient = new Client();
         if (ID != null)
         {
             cClient objClient = cClient.Get_ID(Convert.ToInt32(ID));
             objModelClient.ClientIDHdn   = objClient.iID.ToString();
             objModelClient.ClientName    = objClient.sName;
             objModelClient.EmailIDUpdate = objClient.sEmailID;
             objModelClient.ContactUpdate = objClient.sContactNo;
             objModelClient.Address       = objClient.sAddress;
             objModelClient.Description   = objClient.sDescription;
         }
         return(View(objModelClient));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#7
0
        /// <summary>
        /// Finds and return cClient objects matching the specified criteria
        /// </summary>
        /// <param name="i_oFilter">Filter criteria (WHERE clause)</param>
        /// <returns>cClient objects</returns>
        public static List <cClient> Find(cFilter i_oFilter)
        {
            DataTable      dt = Find_DataTable(i_oFilter, null);
            List <cClient> l  = new List <cClient>();
            cClient        oObj;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                oObj                   = new cClient();
                oObj.m_iID             = Convert.ToInt32(dt.Rows[i]["iID"]);
                oObj.m_sName           = dt.Rows[i]["sName"].ToString();
                oObj.m_dtCreatedOn     = Convert.ToDateTime(dt.Rows[i]["dtCreatedOn"]);
                oObj.m_dtLastUpdatedOn = Convert.ToDateTime(dt.Rows[i]["dtLastUpdatedOn"]);

                oObj.m_sEmailID     = Convert.ToString(dt.Rows[i]["sEmailID"]);
                oObj.m_sContactNo   = Convert.ToString(dt.Rows[i]["sContactNo"]);
                oObj.m_sAddress     = Convert.ToString(dt.Rows[i]["sAddress"]);
                oObj.m_sDescription = Convert.ToString(dt.Rows[i]["sDescription"]);
                oObj.m_bIsActive    = Convert.ToBoolean(dt.Rows[i]["bIsActive"]);
                oObj.m_bInvalid     = false;
                l.Add(oObj);
            }
            return(l);
        }
示例#8
0
using System;