public static int FieldCode_InsertUpdate(string strConn, int?FieldCodeId, int FieldClassId, string FieldCodeName, string FieldCodeAlias,
                                                 string FieldCodeOrder, Guid?CompanyId)
        {
            const string  ProcName   = "FieldCode_InsertUpdate()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@FieldCodeId", SqlDbType.Int);
                    param.Value = FieldCodeId;

                    param       = command.Parameters.Add("@FieldClassId", SqlDbType.Int);
                    param.Value = FieldClassId;

                    param       = command.Parameters.Add("@FieldCodeName", SqlDbType.VarChar);
                    param.Value = FieldCodeName;

                    param       = command.Parameters.Add("@FieldCodeAlias", SqlDbType.VarChar);
                    param.Value = FieldCodeAlias;

                    param       = command.Parameters.Add("@FieldCodeOrder", SqlDbType.VarChar);
                    param.Value = FieldCodeOrder;

                    param       = command.Parameters.Add("@CompanyId", SqlDbType.UniqueIdentifier);
                    param.Value = CompanyId;

                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;

                    rowsEffected = command.ExecuteNonQuery();

                    returnValue = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }
示例#2
0
        public static int  Delete_Process(string strConn, int ProcessId)
        {
            const string  ProcName   = "PROCESS_Delete()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@ProcessId", SqlDbType.Int);
                    param.Value = ProcessId;

                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;

                    rowsEffected = command.ExecuteNonQuery();
                    returnValue  = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }
        private void ParseRequest(string requestMethod, string thePath, string rawUrl, string soapAction)
        {
            string requestPath = thePath.Substring(1);

            DadSpecifiedInRequest = true;
            IsFlexibleParams      = false;
            IsPathAlias           = false;

            string[] pathElements = requestPath.Split('/');

            if (pathElements.Length >= 2)
            {
                ModuleName = pathElements[0];
                DadName    = pathElements[1];

                if (DadName.Length == 0 || !DadConfiguration.IsValidDad(DadName))
                {
                    DadSpecifiedInRequest = false;
                    DadName = DadConfiguration.DefaultDad;
                }

                // get dad-specific configuration settings
                DadConfig = new DadConfiguration(DadName);

                if (pathElements.Length >= 3)
                {
                    ProcName = pathElements[2];
                    if (ProcName.Length > 0)
                    {
                        if (ProcName.Substring(0, 1) == "!")
                        {
                            IsFlexibleParams = true;
                        }
                        else if (ProcName == DadConfig.PathAlias)
                        {
                            IsPathAlias    = true;
                            PathAliasValue = GetAliasValue(ProcName, thePath);
                        }
                        else if (ProcName == DadConfig.XdbAlias)
                        {
                            IsXdbAlias    = true;
                            XdbAliasValue = GetAliasValue(ProcName, thePath);
                        }
                        else if (ProcName == DadConfig.DocumentPath)
                        {
                            IsDocumentPath = true;
                        }
                    }
                }
                else
                {
                    // missing trailing slash in request
                    ProcName = "";
                }

                if (ProcName.Length == 0)
                {
                    ProcName = DadConfig.DefaultPage;
                }

                if (DadConfig.InvocationProtocol == DadConfiguration.INVOCATION_PROTOCOL_SOAP)
                {
                    IsSoapRequest = true;
                    IsWsdlRequest = requestMethod.ToUpper() == "GET" && rawUrl.ToLower().EndsWith("?wsdl");
                }

                if (IsSoapRequest && !IsWsdlRequest)
                {
                    // get the procedure name from the SOAPAction header
                    string methodName = soapAction.Replace("\"", "");
                    methodName = methodName.Substring(methodName.LastIndexOf("/") + 1);
                    ProcName   = ProcName + "." + StringUtil.ReversePrettyStr(methodName);
                }

                ProcName = SanitizeProcName(ProcName, DadConfig.ExclusionList);
            }
            else
            {
                ModuleName = "";
                DadName    = "";
                ProcName   = "";
            }

            if (DadName.Length > 0 && ProcName.Length > 0)
            {
                string[] urlProcElements = ProcName.Split('.');

                if (urlProcElements.Length == 3)
                {
                    // schema, package and procedure specified
                    OraSchema  = urlProcElements[0];
                    OraPackage = urlProcElements[1];
                    OraProc    = urlProcElements[2];
                }
                else if (urlProcElements.Length == 2)
                {
                    // assume package and procedure specified (although it could also be schema and procedure, but there is no way to be certain)
                    OraSchema  = "";
                    OraPackage = urlProcElements[0];
                    OraProc    = urlProcElements[1];
                }
                else
                {
                    // just the procedure is specified
                    OraSchema  = "";
                    OraPackage = "";
                    OraProc    = ProcName;
                }

                logger.Debug("Parsed module = " + ModuleName + ", dad = " + DadName + ", proc = " + ProcName);
            }
        }
示例#4
0
        public static int Rights_InsertUpdate(string strConn, int?RoleRightsId, int RoleId, int ModuleId, bool View, bool Edit, bool Create, bool Delete, Guid?CompanyId)
        {
            const string  ProcName   = "RoleRights_InsertUpdate()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@RoleRightsId", SqlDbType.Int);
                    param.Value = RoleRightsId;

                    param       = command.Parameters.Add("@RoleId", SqlDbType.Int);
                    param.Value = RoleId;

                    param       = command.Parameters.Add("@ModuleId", SqlDbType.Int);
                    param.Value = ModuleId;

                    param       = command.Parameters.Add("@View", SqlDbType.Bit);
                    param.Value = View;

                    param       = command.Parameters.Add("@Edit", SqlDbType.Bit);
                    param.Value = Edit;

                    param       = command.Parameters.Add("@Create", SqlDbType.Bit);
                    param.Value = Create;

                    param       = command.Parameters.Add("@Delete", SqlDbType.Bit);
                    param.Value = Delete;

                    param       = command.Parameters.Add("@CompanyId", SqlDbType.UniqueIdentifier);
                    param.Value = CompanyId;

                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;

                    rowsEffected = command.ExecuteNonQuery();

                    returnValue = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }
示例#5
0
        public static int ProductInsert(string strConn, int?Productid, string ProductName, int UOM,
                                        int Colour, int Texture, Guid CreatedBy, string Processid, int BuyProductId, int BuyProductPacking, int Catagory,
                                        Guid CompanyId)
        {
            const string  ProcName   = "ProductMaster_InsertUpdate()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@Productid", SqlDbType.Int);
                    param.Value = Productid;

                    param       = command.Parameters.Add("@ProductName", SqlDbType.VarChar);
                    param.Value = ProductName;

                    param       = command.Parameters.Add("@UOM", SqlDbType.Int);
                    param.Value = UOM;



                    param       = command.Parameters.Add("@Colour", SqlDbType.Int);
                    param.Value = Colour;

                    param       = command.Parameters.Add("@Texture", SqlDbType.Int);
                    param.Value = Texture;

                    param       = command.Parameters.Add("@CreatedBy", SqlDbType.UniqueIdentifier);
                    param.Value = CreatedBy;

                    param       = command.Parameters.Add("@ProcessId", SqlDbType.VarChar);
                    param.Value = Processid;



                    param       = command.Parameters.Add("@BuyProductId", SqlDbType.Int);
                    param.Value = BuyProductId;
                    param       = command.Parameters.Add("@Catagory", SqlDbType.Int);
                    param.Value = Catagory;

                    param       = command.Parameters.Add("@BuyProductPacking", SqlDbType.Int);
                    param.Value = BuyProductPacking;

                    param           = command.Parameters.Add("@CompanyId", SqlDbType.UniqueIdentifier);
                    param.Value     = CompanyId;
                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;


                    rowsEffected = command.ExecuteNonQuery();
                    returnValue  = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }
示例#6
0
        public static int UOMMaster_InsertUpdate(string strConn, int UOMId, int UOMTypeId, string UOMName, string UOMCode,
                                                 int DecimalPoints, bool BaseUnit, decimal ConversionRation, Guid?CreatedBy, Guid?ModifiedBy, Guid?CompanyId)
        {
            const string  ProcName   = "UOMMaster_InsertUpdate()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@UOMId", SqlDbType.Int);
                    param.Value = UOMId;

                    param       = command.Parameters.Add("@UOMTypeId", SqlDbType.Int);
                    param.Value = UOMTypeId;

                    param       = command.Parameters.Add("@UOMName", SqlDbType.VarChar);
                    param.Value = UOMName;

                    param       = command.Parameters.Add("@UOMCode", SqlDbType.VarChar);
                    param.Value = UOMCode;

                    param       = command.Parameters.Add("@DecimalPoints", SqlDbType.Int);
                    param.Value = DecimalPoints;

                    param       = command.Parameters.Add("@BaseUnit", SqlDbType.Bit);
                    param.Value = BaseUnit;

                    param       = command.Parameters.Add("@ConversionRation", SqlDbType.Decimal);
                    param.Value = ConversionRation;

                    param       = command.Parameters.Add("@CreatedBy", SqlDbType.UniqueIdentifier);
                    param.Value = CreatedBy;

                    param       = command.Parameters.Add("@ModifiedBy", SqlDbType.UniqueIdentifier);
                    param.Value = ModifiedBy;

                    param       = command.Parameters.Add("@CompanyId", SqlDbType.UniqueIdentifier);
                    param.Value = CompanyId;

                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;

                    rowsEffected = command.ExecuteNonQuery();

                    returnValue = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }
示例#7
0
        public static int ProcessInsert(string strConn, int?ProcessId, string ProcessName, bool QuantityFlag,
                                        bool PackingFlag, String ProcessDuration, float ProcessVolume, bool WastageFlag, int ProcessUnit, Guid?CompanyId, bool byProduct)
        {
            const string  ProcName   = "ProcessMaster_InserUpdate()";
            SqlConnection connection = null;
            SqlParameter  param;
            DateTime      startDate  = DateTime.Now;
            Guid          LoginID    = Guid.Empty;
            string        strMessage = string.Empty;
            DataTable     dt         = new DataTable();
            int           rowsEffected;
            int           returnValue;

            try
            {
                connection = DataSource.GetConnection(strConn);
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandText = ProcName.Substring(0, ProcName.Length - 2);
                    command.Connection  = connection;
                    command.CommandType = CommandType.StoredProcedure;

                    param       = command.Parameters.Add("@ProcessId", SqlDbType.Int);
                    param.Value = ProcessId;


                    param       = command.Parameters.Add("@ProcessName", SqlDbType.VarChar);
                    param.Value = ProcessName;


                    param       = command.Parameters.Add("@QuantityFlag", SqlDbType.Bit);
                    param.Value = QuantityFlag;

                    param       = command.Parameters.Add("@PackingFlag", SqlDbType.Bit);
                    param.Value = PackingFlag;
                    param       = command.Parameters.Add("@ProcessDuration", SqlDbType.Time);
                    param.Value = ProcessDuration;
                    param       = command.Parameters.Add("@WastageFlag", SqlDbType.Bit);
                    param.Value = WastageFlag;
                    param       = command.Parameters.Add("@QuantityFlag", SqlDbType.Bit);
                    param.Value = QuantityFlag;

                    param       = command.Parameters.Add("@ByProduct", SqlDbType.Bit);
                    param.Value = byProduct;
                    param       = command.Parameters.Add("@ProcessVolume", SqlDbType.Float);
                    param.Value = ProcessVolume;

                    param       = command.Parameters.Add("@CompanyId", SqlDbType.UniqueIdentifier);
                    param.Value = CompanyId;

                    param           = command.Parameters.Add("@ReturnValue", SqlDbType.Int);
                    param.Direction = ParameterDirection.ReturnValue;
                    param           = command.Parameters.Add("@ProcessUnit", SqlDbType.Int);
                    param.Value     = ProcessUnit;

                    rowsEffected = command.ExecuteNonQuery();
                    returnValue  = (int)command.Parameters["@ReturnValue"].Value;
                }
            }
            finally
            {
                DataSource.CloseConnection(connection);

                TimeSpan timeSpan = DateTime.Now.Subtract(startDate);
            }
            return(returnValue);
        }