public JsonResult CreateWOTypeA(int WOTypeId, string WOName, string CategoryCode, string code, string desc, bool status)
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                Int32 returnValue = -2;
                int checkSession = UserLogin.AuthenticateRequest();
                int createdBy = Convert.ToInt32(Session["UserID"]);

                if (checkSession == 0)
                {
                    return Json(returnValue);
                }
                else
                {
                    var data = new WOTypes
                    {
                        WOTypeId = WOTypeId,
                        WOCategoryCode = CategoryCode,
                        WOCode = HttpUtility.UrlDecode(code),
                        WOName = HttpUtility.UrlDecode(WOName),
                        WODescription = HttpUtility.UrlDecode(desc),
                        Status = status,
                        CreatedBy = createdBy
                    };

                    int result = data.InsertOrUpdateWOType();
                    return Json(result);
                }
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return Json("");
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Example #2
0
 private WOTypes FetchService(WOTypes wotypes, SafeDataReader dr)
 {
     wotypes.WOTypeId = dr.GetInt32("ID");
     wotypes.WOName = dr.GetString("Name");
     wotypes.WOCategoryCode = dr.GetString("CategoryCode");
     wotypes.WOCode = dr.GetString("Code");
     wotypes.WODescription = dr.GetString("Description");
     wotypes.Status = dr.GetBoolean("Status");
     return wotypes;
 }
Example #3
0
        /// <summary>
        /// Created By    : Sudheer
        /// Created Date  : 15 Sep 2014
        /// Modified By   :  
        /// Modified Date :  
        /// Description   : To Insert or Update the WOType A
        /// </summary>    
        public static WOTypes GetWOTypeById(int? id)
        {
            var wotype = new WOTypes();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@id", id);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetWOTypeById]", sqlParams);

                while (reader.Read())
                {
                    wotype.FetchService(wotype, new SafeDataReader(reader));
                }
                return wotype;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return wotype;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Example #4
0
        /// <summary>
        /// Created By    : Sudheer
        /// Created Date  : 15 Sep 2014
        /// Modified By   :  
        /// Modified Date :  
        /// Description   : To Insert or Update the WOType A
        /// </summary>    
        public static WOTypeInfo GetAllWOTypes(int startPage, int resultPerPage, string Name, int status, string OrderBy)
        {
            var data = new WOTypeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[5];
                sqlParams[0] = new SqlParameter("@startPage", startPage);
                sqlParams[1] = new SqlParameter("@resultPerPage", resultPerPage);
                sqlParams[2] = new SqlParameter("@Name", Name);
                sqlParams[3] = new SqlParameter("@status", status);
                sqlParams[4] = new SqlParameter("@OrderBy", OrderBy);

                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetAllMWOType]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var wotype = new WOTypes();
                    wotype.FetchService(wotype, safe);

                    data.WOTypeList.Add(wotype);
                    data.wotypeCount = Convert.ToInt32(reader["wotypecount"]);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }