예제 #1
0
        public async Task <JsonResult> CreatePartner(long firmList)
        {
            var user = WFS.web.Session.SessionUser.User;
            var fm   = new business.Management.FirmManagement.FirmFunctions();

            try
            {
                using (business.Management.PartnerManagement.PartnerFunctions partnerM = new business.Management.PartnerManagement.PartnerFunctions())
                {
                    var selectedManager = partnerM.selectManager(firmList);
                    if (partnerM.isPartnerExist(selectedManager.ManagerFirmId, user.Firm_Id))
                    {
                        CustomerFirmManager newcfManager = new CustomerFirmManager
                        {
                            ClientId = selectedManager.ClientManagerId,
                            Token    = Guid.NewGuid().ToString()
                        };
                        fm.addCustomerFirm(user.Firm_Id, newcfManager);
                        return(await Task.Run(() => Json(new { result = true, message = "Partner eklendi." }, JsonRequestBehavior.AllowGet)));
                    }
                    else
                    {
                        return(await Task.Run(() => Json(new { result = false, message = "Partner zaten kayıtlı." }, JsonRequestBehavior.AllowGet)));
                    }
                }
            }
            catch (Exception)
            {
                return(await Task.Run(() => Json(new { result = false, message = "Hata oluştu." }, JsonRequestBehavior.AllowGet)));
            }
        }
예제 #2
0
        public JsonResult selectFirm(long firmId)
        {
            using (business.Management.FirmManagement.FirmFunctions ff = new business.Management.FirmManagement.FirmFunctions())
            {
                var selectedFirm    = ff.selectFirm(firmId);
                var pm              = new business.Management.PartnerManagement.PartnerFunctions();
                var selectedManager = pm.selectManager(selectedFirm.FirmId);

                if (selectedFirm != null)
                {
                    return(Json(new { result = true, firm = selectedFirm, manager = selectedManager }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
                }
            }
        }