Example #1
0
        public SAPProcess objGetSAPProcess(string argProcessCode, string argClientCode)
        {
            SAPProcess argSAPProcess = new SAPProcess();
            DataSet    DataSetToFill = new DataSet();

            if (argProcessCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetSAPProcess(argProcessCode, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argSAPProcess = this.objCreateSAPProcess((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argSAPProcess);
        }
Example #2
0
        private SAPProcess objCreateSAPProcess(DataRow dr)
        {
            SAPProcess tSAPProcess = new SAPProcess();

            tSAPProcess.SetObjectInfo(dr);

            return(tSAPProcess);
        }
Example #3
0
        public string UpdateSAPProcess(SAPProcess argSAPProcess, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[10];
            param[0] = new SqlParameter("@ProcessCode", argSAPProcess.ProcessCode);
            param[1] = new SqlParameter("@ProcessName", argSAPProcess.ProcessName);
            param[2] = new SqlParameter("@Activity", argSAPProcess.Activity);
            param[3] = new SqlParameter("@BAPIName", argSAPProcess.BAPIName);
            param[4] = new SqlParameter("@ClientCode", argSAPProcess.ClientCode);
            param[5] = new SqlParameter("@CreatedBy", argSAPProcess.CreatedBy);
            param[6] = new SqlParameter("@ModifiedBy", argSAPProcess.ModifiedBy);

            param[7]           = new SqlParameter("@Type", SqlDbType.Char);
            param[7].Size      = 1;
            param[7].Direction = ParameterDirection.Output;

            param[8]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[8].Size      = 255;
            param[8].Direction = ParameterDirection.Output;

            param[9]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[9].Size      = 20;
            param[9].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateSAPProcess", param);


            string strMessage  = Convert.ToString(param[8].Value);
            string strType     = Convert.ToString(param[7].Value);
            string strRetValue = Convert.ToString(param[9].Value);


            objErrorHandler.Type        = strType;
            objErrorHandler.MsgId       = 0;
            objErrorHandler.Module      = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart  = ErrorConstant.strMasterModule;
            objErrorHandler.Message     = strMessage.ToString();
            objErrorHandler.RowNo       = 0;
            objErrorHandler.FieldName   = "";
            objErrorHandler.LogCode     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);

            return(strRetValue);
        }
Example #4
0
        public ICollection <SAPProcess> colGetSAPProcess(string argClientCode)
        {
            List <SAPProcess> lst           = new List <SAPProcess>();
            DataSet           DataSetToFill = new DataSet();
            SAPProcess        tSAPProcess   = new SAPProcess();

            DataSetToFill = this.GetSAPProcess(argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateSAPProcess(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
Example #5
0
        public ICollection <ErrorHandler> SaveSAPProcess(SAPProcess argSAPProcess)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsSAPProcessExists(argSAPProcess.ProcessCode, argSAPProcess.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertSAPProcess(argSAPProcess, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateSAPProcess(argSAPProcess, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }
Example #6
0
        public ICollection <ErrorHandler> SaveSAPProcess(SAPProcess argSAPProcess, ICollection <SAPParam> colSAPParam, ICollection <SAPField> ColSAPField)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();
            string strretValue         = "";

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();

                if (blnIsSAPProcessExists(argSAPProcess.ProcessCode, argSAPProcess.ClientCode, da) == false)
                {
                    strretValue = InsertSAPProcess(argSAPProcess, da, lstErr);
                }
                else
                {
                    strretValue = UpdateSAPProcess(argSAPProcess, da, lstErr);
                }

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }

                    if (objerr.Type == "A")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

                if (strretValue != "")
                {
                    if (colSAPParam.Count > 0)
                    {
                        foreach (SAPParam argSAPParam in colSAPParam)
                        {
                            argSAPParam.ProcessCode = Convert.ToString(strretValue);

                            if (argSAPParam.IsDeleted == 0)
                            {
                                ObjSAPParamManager.SaveSAPParam(argSAPParam, da, lstErr);
                            }
                            else
                            {
                                ObjSAPParamManager.DeleteSAPParam(argSAPParam.ProcessCode, argSAPParam.ParamNo, argSAPParam.ClientCode, da, lstErr);
                            }

                            if (ColSAPField.Count > 0)
                            {
                                foreach (SAPField argSAPField in ColSAPField)
                                {
                                    if (argSAPParam.ProcessCode == argSAPField.ProcessCode && argSAPParam.ParamNo == argSAPField.ParamNo)
                                    {
                                        if (argSAPField.IsDeleted == 0)
                                        {
                                            objSAPFieldManager.SaveSAPField(argSAPField, da, lstErr);
                                        }
                                        else
                                        {
                                            objSAPFieldManager.DeleteSAPField(argSAPField.ProcessCode, argSAPField.ParamNo, argSAPField.FieldNo, argSAPField.ClientCode, argSAPField.IsDeleted, da, lstErr);
                                        }
                                    }
                                }
                            }
                        }

                        foreach (ErrorHandler objerr in lstErr)
                        {
                            if (objerr.Type == "E")
                            {
                                da.ROLLBACK_TRANSACTION();
                                return(lstErr);
                            }

                            if (objerr.Type == "A")
                            {
                                da.ROLLBACK_TRANSACTION();
                                return(lstErr);
                            }
                        }
                    }
                }
                da.COMMIT_TRANSACTION();
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }