コード例 #1
0
        public string SubmitCreateFuelData(FuelData FuelData)
        {
            var                       User     = System.Web.HttpContext.Current.User.Identity.Name;
            FormsIdentity             id       = (FormsIdentity)HttpContext.Current.User.Identity;
            FormsAuthenticationTicket ticket   = id.Ticket;
            string                    userData = ticket.UserData;

            string[]  roles     = userData.Split(',');
            string    userRole  = roles[0];
            UserOpMap userOpMap = new UserOpMap();

            BAL.BAL_Common bAL_Common = new BAL.BAL_Common();
            userOpMap = bAL_Common.GetUserOperationMapping(HttpContext.Current.User.Identity.Name, userRole);

            EntitySubmittedResponse entitySubmittedResponse = new EntitySubmittedResponse();

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            try
            {
                BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel();
                long         fuelID   = bAL_Fuel.CreateFuel(FuelData, userOpMap);
                entitySubmittedResponse.submited = true;
                entitySubmittedResponse.message  = "Fuel submitted!";
                return(js.Serialize("Fuel Created"));
            }
            catch (Exception ex)
            {
                entitySubmittedResponse.submited = false;
                entitySubmittedResponse.message  = string.Format("Error occured while generating Bill with message:{0}", ex.Message);
                //return js.Serialize(entitySubmittedResponse);
                return(js.Serialize(string.Format("Error occured while generating Bill with message:{0}", ex.Message)));
            }
        }