Example #1
0
        public static bool Save_ServiceClass(bool isOnlyDelete, ServiceClassInfo obj, UserInfo objUserInfo, out string errormsg)
        {
            errormsg = "";

            #region Validations
            if (!Validations.ValidateDataType(obj.ServiceClassId, Validations.ValueType.Integer, true, "ServiceClass Id", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(obj.ServiceClassName, Validations.ValueType.AlphaNumericSpecialChar, true, "ServiceClass Name", out errormsg))
            {
                return(false);
            }
            #endregion

            using (DBHelper dbhlper = new DBHelper("[spMSTServiceClassSave]", true))
            {
                DBHelper.AddPparameter("@ServiceClassId", obj.ServiceClassId, DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@ServiceClassName", obj.ServiceClassName, DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@IsActive", (obj.IsActive ? "Y" : "N"), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@UserCode", objUserInfo.UserCode.ToString().Trim(), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@isOnlyDelete", (isOnlyDelete ? 'Y' : 'N'), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@NewDatauniqueID", 0, DBHelper.param_types.BigInt, 50, DBHelper.param_direction.Output);
                DBHelper.AddPparameter("@ErrorMessage", errormsg, DBHelper.param_types.Varchar, 500, DBHelper.param_direction.Output);

                return(DBHelper.Execute_NonQuery(out errormsg));
            }
        }
Example #2
0
        public static List <ServiceClassInfo> GetList_ServiceClass(string ServiceClassID, string ServiceClassName, bool IsActive)
        {
            using (DBHelper dbhlper = new DBHelper("[spMSTServiceClassGet]"))
            {
                DBHelper.AddPparameter("@ServiceClassId", ServiceClassID);
                DBHelper.AddPparameter("@ServiceClassName", ServiceClassName);

                using (DataSet ds = DBHelper.Execute_Query())
                {
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        List <ServiceClassInfo> list = new List <ServiceClassInfo>();
                        ServiceClassInfo        obj  = null;

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            obj = new ServiceClassInfo();
                            obj.ServiceClassId   = dr["ServiceClassID"].ToString();
                            obj.ServiceClassName = dr["ServiceClassName"].ToString();
                            obj.LastModifiedOn   = Convert.ToDateTime(dr["LastModifiedOn"]);
                            obj.LastModifiedBy   = dr["LastModifiedBy"].ToString();
                            obj.ActivityType     = dr["ActivityType"].ToString();
                            obj.IsActive         = dr["IsActive"].ToString().Trim().ToUpper() == "Y";
                            obj.DatauniqueID     = dr["DatauniqueID"].ToString();

                            list.Add(obj);
                        }

                        return(list);
                    }
                }
            }

            return(null);
        }
Example #3
0
        public ActionResult Save_ServiceClass(string isOnlyDelete, string ServiceClassId, string ServiceClassName, string IsActive)
        {
            using (Master_Svc.MasterServiceClient iGstSvc = new Master_Svc.MasterServiceClient())
            {
                ServiceClassInfo objServiceClass = new ServiceClassInfo();
                objServiceClass.ServiceClassId   = ServiceClassId;
                objServiceClass.ServiceClassName = ServiceClassName;
                objServiceClass.IsActive         = IsActive.Trim().ToUpper() == "Y";

                if (iGstSvc.Save_ServiceClass(isOnlyDelete.Trim().ToUpper() == "Y", objServiceClass, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                {
                    return(Json("Ok", JsonRequestBehavior.AllowGet));
                }
                return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
            }
        }
Example #4
0
        private void InitialiseProviders(ProviderSettings settings)
        {
            log.Debug("Initialising ProviderFactory (currently only supports Functional Services)");
            // settings.Classes only returns functional services at the moment, but can easily be extended to other types of services.
            foreach (Type type in Classes)
            {
                log.Debug("Provider class to initialse: " + type.FullName);
                try
                {
                    ServiceClassInfo providerClassInfo = new ServiceClassInfo(type, Type.EmptyTypes);

                    if (!providerClassInfo.HasConstructor())
                    {
                        log.Error("The provider class " + type.FullName + " does not have a valid constructor. Must have a public constructor that takes no arguments.");
                        continue;
                    }

                    IFunctionalService provider = providerClassInfo.GetClassInstance() as IFunctionalService;

                    string providerName = provider.GetServiceName();

                    log.Info("Adding provider for '" + providerName + "', using provider class '" + provider.GetType().FullName + "'.");

                    // First add it to the standard request/response dictionary
                    providerClasses[providerName] = providerClassInfo;

                    // Add it to dictionary of providers
                    providers[providerName] = provider;

                    // Add it to dictionary of background threads
                    providerThreads[providerName] = new Thread(new ThreadStart(provider.Startup));
                    // Each thread is essentially a global instance of a service whose responsibility is to maintain the services using timed tasks etc. - it never recieves any REST calls.
                }
                catch (Exception ex)
                {
                    log.Error("Cannot create Provider Class " + type.FullName + ": " + ex.Message, ex);
                }
            }
        }
Example #5
0
 public bool Save_ServiceClass(bool isOnlyDelete, ServiceClassInfo obj, UserInfo objUserInfo, out string errormsg)
 {
     return(wscalls.Save_ServiceClass(isOnlyDelete, obj, objUserInfo, out errormsg));
 }