示例#1
0
        /// <summary>
        /// Delete a workarea in db (Master)
        /// </summary>
        /// <returns></returns>
        public int Delete()
        {
            int      _result     = 0;
            Workarea objWorkarea = this;
            Config   ObjConfig   = (Config)HttpContext.Current.Session["__Config__"];
            string   Query       = "SP_Workarea";

            switch (ObjConfig.DBType)
            {
            // MS-SQL
            case "0":
            {
                DBController        ObjDB = new DBController(DBController.DBTypes.MSSQL);
                List <SqlParameter> parms = new List <SqlParameter>();

                parms.Add(new SqlParameter("CustomerID", objWorkarea.CustomerID));
                parms.Add(new SqlParameter("CompanyID", objWorkarea.CompanyID));
                parms.Add(new SqlParameter("WorkareaID", objWorkarea.WorkareaID));
                parms.Add(new SqlParameter("Status", ((int)Status.Deleted).ToString()));

                parms.Add(new SqlParameter("Flag", ((int)DB_Flags.FullDelete).ToString()));

                _result = ObjDB.ExecuteNonQuery(Query, parms.ToArray());
                break;
            }
            }
            return(_result);
        }
示例#2
0
        /// <summary>
        /// Update a workarea in db (Master)
        /// </summary>
        /// <returns></returns>
        public int Update()
        {
            int      _result     = 0;
            Workarea objWorkarea = this;
            Config   ObjConfig   = (Config)HttpContext.Current.Session["__Config__"];
            string   Query       = "SP_Workarea";

            switch (ObjConfig.DBType)
            {
            // MS-SQL
            case "0":
            {
                DBController        ObjDB = new DBController(DBController.DBTypes.MSSQL);
                List <SqlParameter> parms = new List <SqlParameter>();

                parms.Add(new SqlParameter("CustomerID", objWorkarea.CustomerID));
                parms.Add(new SqlParameter("CompanyID", objWorkarea.CompanyID));
                parms.Add(new SqlParameter("WorkareaID", objWorkarea.WorkareaID));
                parms.Add(new SqlParameter("WorkareaName", objWorkarea.WorkareaName));
                parms.Add(new SqlParameter("WorkareaCode", objWorkarea.WorkareaCode));
                parms.Add(new SqlParameter("YearOfEstablishment", objWorkarea.YearOfEstablishment));
                parms.Add(new SqlParameter("Priority", objWorkarea.Priority));

                parms.Add(new SqlParameter("PhoneNumber", objWorkarea.PhoneNumber));
                parms.Add(new SqlParameter("FaxNumber", objWorkarea.FaxNumber));
                parms.Add(new SqlParameter("Email", objWorkarea.Email));
                parms.Add(new SqlParameter("PrimaryAddress", objWorkarea.PrimaryAddress));
                parms.Add(new SqlParameter("StateID", objWorkarea.StateID));
                parms.Add(new SqlParameter("CountryID", objWorkarea.CountryID));
                parms.Add(new SqlParameter("Pincode", objWorkarea.Pincode));
                parms.Add(new SqlParameter("Website", objWorkarea.Website));

                parms.Add(new SqlParameter("LeaveGroupID", objWorkarea.LeaveGroupID));
                parms.Add(new SqlParameter("ShiftGroupID", objWorkarea.ShiftGroupID));
                parms.Add(new SqlParameter("AllowanceGroupID", objWorkarea.AllowanceGroupID));
                parms.Add(new SqlParameter("HolidayGroupID", objWorkarea.HolidayGroupID));

                parms.Add(new SqlParameter("CST", objWorkarea.CST));
                parms.Add(new SqlParameter("TIN", objWorkarea.TIN));
                parms.Add(new SqlParameter("PAN", objWorkarea.PAN));
                parms.Add(new SqlParameter("TAN", objWorkarea.TAN));
                parms.Add(new SqlParameter("GST", objWorkarea.GST));

                parms.Add(new SqlParameter("PFCode", objWorkarea.PFCode));
                parms.Add(new SqlParameter("ESICode", objWorkarea.ESICode));

                parms.Add(new SqlParameter("CreatedDate", objWorkarea.CreatedDate));
                parms.Add(new SqlParameter("CreatedTime", objWorkarea.CreatedTime));
                parms.Add(new SqlParameter("CreatedBy", objWorkarea.CreatedBy));
                parms.Add(new SqlParameter("ModifiedDate", objWorkarea.ModifiedDate));
                parms.Add(new SqlParameter("ModifiedTime", objWorkarea.ModifiedTime));
                parms.Add(new SqlParameter("ModifiedBy", objWorkarea.ModifiedBy));
                parms.Add(new SqlParameter("Status", ((int)objWorkarea.Status).ToString()));

                parms.Add(new SqlParameter("Flag", ((int)DB_Flags.Update).ToString()));

                _result = ObjDB.ExecuteNonQuery(Query, parms.ToArray());
                break;
            }
            }
            return(_result);
        }