Beispiel #1
0
        public static void CreateWS(WsCreate wsCreate)
        {
            string postData = string.Format("EngNum={0}&EngDescription={1}&ClientId={2}&ManagerEmpId={3}&PartnerEmpId={4}&PartnerAssistanceEmpId={5}&KPMGOnly={6}&IsAuto={7}",
                wsCreate.EngagementNumber, wsCreate.EngagementDescription, wsCreate.ClientId, wsCreate.ManagerEmpId, wsCreate.PartnerEmpId, wsCreate.PartnerAssistanceEmpId, true, false);

            string url = string.Format("{0}{1}CreateWS", ConfigUtility.GetKWebAppBaseUrl, CreateWSController);

            using (WebClient wc = new WebClient())
            {
                wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                wc.UseDefaultCredentials = true;

                string htmlResult = wc.UploadString(url, postData);

                var result = JsonConvert.DeserializeObject<dynamic>(htmlResult);

                if (!result.SelectToken("Success").Value)
                    throw new Exception(result.SelectToken("FailureMsg").Value);
            }
        }
        public void CreateWs(FormDataCollection formData)
        {
            //Select * From Ref.Eng_WS_Metadata_V2 Where [EngagementID]  = @eID

            if (AuditManager.Rep.AmUtility.IsWSExists(formData.Get("txtEngId_CreateWs")))
            {
                throw new Exception(string.Format("Workspace => {0} already exists.", formData.Get("txtEngId_CreateWs")));
            }
            else
            {
                var wsCreate = new AuditManager.Model.WsCreate
                {
                    EngagementNumber = formData.Get("txtEngId_CreateWs"),
                    EngagementDescription = formData.Get("txtEngName_CreateWs"),

                    ClientId = formData.Get("txtClientNumber_CreateWs"),
                    ClientName = formData.Get("txtClient_CreateWs"),

                    ManagerId = formData.Get("txtEngMgrId_CreateWs"),
                    ManagerEmpId = formData.Get("txtEngMgrEmpId_CreateWs"),

                    ManagerName = formData.Get("txtEngMgr_CreateWs"),
                    ManagerFunction = formData.Get("txtManagerFunction"),

                    PartnerId = formData.Get("txtEngParId_CreateWs"),
                    PartnerEmpId = formData.Get("txtEngParEmpId_CreateWs"),

                    PartnerName = formData.Get("txtEngPar_CreateWs"),
                    PartnerFunction = formData.Get("txtPartnerFunction"),

                    ParentCompany = formData.Get("txtParentCompany"),

                    PartnerAssistanceId = formData.Get("txtPartnerAssistanceId"),
                    PartnerAssistanceEmpId = formData.Get("txtPartnerAssistanceEmpId"),

                    PartnerAssistanceName = formData.Get("txtPartnerAssistanceName"),

                    //WsProfile_TP = new WsProfile_TP
                    //{
                    //    TP_Q1 = formData.Get("radAgrClient_CreateWs"),
                    //    TP_Q2 = formData.Get("radAgrClientCal_CreateWs"),
                    //    TP_Q3 = formData.Get("radKPMGContEnt_CreateWs"),
                    //    TP_Q3_Comment = formData.Get("txtADesc_CreateWs"),
                    //}
                };

                //var engNum = formData.Get("txtEngId_CreateWs");
                //var engName = formData.Get("txtEngName_CreateWs");

                //var clientName = formData.Get("txtClient_CreateWs");
                //var clientNum = formData.Get("txtClientNumber_CreateWs");

                //var mgrName = formData.Get("txtEngMgr_CreateWs");
                //var mgrId = formData.Get("txtEngMgrId_CreateWs");
                //var mgrFun = formData.Get("txtManagerFunction");

                //var parName = formData.Get("txtEngPar_CreateWs");
                //var parId = formData.Get("txtEngParId_CreateWs");
                //var parFun = formData.Get("txtPartnerFunction");

                //var parentCompany = formData.Get("txtParentCompany");

                //WsProfile_TP wsProfile_TP = new WsProfile_TP();

                //wsProfile_TP.TP_Q1 = formData.Get("radAgrClient_CreateWs");
                //wsProfile_TP.TP_Q2 = formData.Get("radAgrClientCal_CreateWs");
                //wsProfile_TP.TP_Q3 = formData.Get("radKPMGContEnt_CreateWs");
                //wsProfile_TP.TP_Q3_Comment = formData.Get("txtADesc_CreateWs");

                //AuditManager.Rep.WsOperation.UpdateWsProfile(formData.Get("txtEngId_CreateWs"), wsProfile_TP);

                //AuditManager.Rep.WsCreate.CreateWS(wsCreate);
                ExtApi.CreateWS(wsCreate);
            }
        }
Beispiel #3
0
        public static void CreateWS(AuditManager.Model.WsCreate wsCreate)
        {
            //IM.Mgr.WsUtility.CreateWS(wsCreate)

            //using (new TransactionScope(
            //        TransactionScopeOption.Required,
            //        new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted }))
            //{
            using (var db = new ActiveDbContext())
            {
                var p = wsCreate.PartnerId.ToUserIdFromDnsName();
                var m = wsCreate.ManagerId.ToUserIdFromDnsName();

                var c4 = db.CUSTOM4.Where(x => x.CUSTOM_ALIAS.Equals(p)).FirstOrDefault();
                if (c4 == null)
                {
                    var p_db = WsUsrMgmt.SearchUsr(p, Model.UsrSearchBy.Email, true);

                    if (p_db != null && p_db.Count > 0)
                    {
                        var p_2_In = p_db.FirstOrDefault();

                        var p_In = db.CUSTOM4.Add(new CUSTOM4
                        {
                            CUSTOM_ALIAS = p_2_In.Name,
                            C_DESCRIPT   = p_2_In.FullName,
                            EDITWHEN     = DateTime.Now,
                            ENABLED      = "Y",
                            IS_HIPAA     = "N"
                        });

                        db.SaveChanges();
                    }
                    else
                    {
                        throw new Exception(string.Format("Failure creating workspace: Partner => {0} not defined in [DOCUSERS] table.", p));
                    }
                }

                var c6 = db.CUSTOM6.Where(x => x.CUSTOM_ALIAS.Equals(m)).FirstOrDefault();
                if (c6 == null)
                {
                    var m_db = WsUsrMgmt.SearchUsr(m, Model.UsrSearchBy.Email, true);

                    if (m_db != null && m_db.Count > 0)
                    {
                        var m_2_In = m_db.FirstOrDefault();

                        var m_In = db.CUSTOM6.Add(new CUSTOM6
                        {
                            CUSTOM_ALIAS = m_2_In.Name,
                            C_DESCRIPT   = m_2_In.FullName,
                            EDITWHEN     = DateTime.Now,
                            ENABLED      = "Y",
                            IS_HIPAA     = "N"
                        });

                        db.SaveChanges();
                    }
                    else
                    {
                        throw new Exception(string.Format("Failure creating workspace: Manager => {0} not defined in [DOCUSERS] table.", m));
                    }
                }
            }
            //}

            //var cur_Eng = AuditManager.Rep.Workspace.GetEngByEngNum(wsCreate.EngagementNumber, Model.WsLoadType.None, true);

            //if (cur_Eng == null
            //    || cur_Eng.Count == 0)
            //{
            //    IM.Mgr.WsUtility.CreateWS(wsCreate);
            //    AuditManager.Rep.WsOperation.UpdateWsProfile(wsCreate.EngagementNumber, wsCreate.WsProfile_TP, Model.UpdateProfileFrom.CreateWs);
            //    return;
            //}
            //else
            //{
            //    throw new Exception(string.Format("Workspace => {0} already exists.", wsCreate.EngagementNumber));
            //}

            IM.Mgr.WsUtility.CreateWS(wsCreate);

            //AuditManager.Rep.WsOperation.UpdateWsProfile(wsCreate.EngagementNumber, wsCreate.WsProfile_TP, Model.UpdateProfileFrom.CreateWs);

            return;
        }
Beispiel #4
0
        public void CreateWs(FormDataCollection formData)
        {
            //Select * From Ref.Eng_WS_Metadata_V2 Where [EngagementID]  = @eID

            if (AuditManager.Rep.AmUtility.IsWSExists(formData.Get("txtEngId_CreateWs")))
            {
                throw new Exception(string.Format("Workspace => {0} already exists.", formData.Get("txtEngId_CreateWs")));
            }
            else
            {
                var wsCreate = new AuditManager.Model.WsCreate
                {
                    EngagementNumber      = formData.Get("txtEngId_CreateWs"),
                    EngagementDescription = formData.Get("txtEngName_CreateWs"),

                    ClientId   = formData.Get("txtClientNumber_CreateWs"),
                    ClientName = formData.Get("txtClient_CreateWs"),

                    ManagerId    = formData.Get("txtEngMgrId_CreateWs"),
                    ManagerEmpId = formData.Get("txtEngMgrEmpId_CreateWs"),

                    ManagerName     = formData.Get("txtEngMgr_CreateWs"),
                    ManagerFunction = formData.Get("txtManagerFunction"),

                    PartnerId    = formData.Get("txtEngParId_CreateWs"),
                    PartnerEmpId = formData.Get("txtEngParEmpId_CreateWs"),

                    PartnerName     = formData.Get("txtEngPar_CreateWs"),
                    PartnerFunction = formData.Get("txtPartnerFunction"),

                    ParentCompany = formData.Get("txtParentCompany"),

                    PartnerAssistanceId    = formData.Get("txtPartnerAssistanceId"),
                    PartnerAssistanceEmpId = formData.Get("txtPartnerAssistanceEmpId"),

                    PartnerAssistanceName = formData.Get("txtPartnerAssistanceName"),

                    //WsProfile_TP = new WsProfile_TP
                    //{
                    //    TP_Q1 = formData.Get("radAgrClient_CreateWs"),
                    //    TP_Q2 = formData.Get("radAgrClientCal_CreateWs"),
                    //    TP_Q3 = formData.Get("radKPMGContEnt_CreateWs"),
                    //    TP_Q3_Comment = formData.Get("txtADesc_CreateWs"),
                    //}
                };

                //var engNum = formData.Get("txtEngId_CreateWs");
                //var engName = formData.Get("txtEngName_CreateWs");

                //var clientName = formData.Get("txtClient_CreateWs");
                //var clientNum = formData.Get("txtClientNumber_CreateWs");

                //var mgrName = formData.Get("txtEngMgr_CreateWs");
                //var mgrId = formData.Get("txtEngMgrId_CreateWs");
                //var mgrFun = formData.Get("txtManagerFunction");

                //var parName = formData.Get("txtEngPar_CreateWs");
                //var parId = formData.Get("txtEngParId_CreateWs");
                //var parFun = formData.Get("txtPartnerFunction");

                //var parentCompany = formData.Get("txtParentCompany");

                //WsProfile_TP wsProfile_TP = new WsProfile_TP();

                //wsProfile_TP.TP_Q1 = formData.Get("radAgrClient_CreateWs");
                //wsProfile_TP.TP_Q2 = formData.Get("radAgrClientCal_CreateWs");
                //wsProfile_TP.TP_Q3 = formData.Get("radKPMGContEnt_CreateWs");
                //wsProfile_TP.TP_Q3_Comment = formData.Get("txtADesc_CreateWs");

                //AuditManager.Rep.WsOperation.UpdateWsProfile(formData.Get("txtEngId_CreateWs"), wsProfile_TP);

                //AuditManager.Rep.WsCreate.CreateWS(wsCreate);
                ExtApi.CreateWS(wsCreate);
            }
        }