示例#1
0
        public messageModel workListApproveSubmit(dashBoardModel value)
        {
            messageModel result = new messageModel();

            try
            {
                result.status  = "S";
                result.message = "";

                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }

                    System.Data.Entity.Core.Objects.ObjectParameter myOutputParam_sts = new System.Data.Entity.Core.Objects.ObjectParameter("r_sts", typeof(String));
                    System.Data.Entity.Core.Objects.ObjectParameter myOutputParam_msg = new System.Data.Entity.Core.Objects.ObjectParameter("r_msg", typeof(String));


                    System.Data.Entity.Core.Objects.ObjectParameter myOutputParamInt = new System.Data.Entity.Core.Objects.ObjectParameter("r_id", typeof(Int32));
                    foreach (var item in value.select_room_list)
                    {
                        context.sp_bookroom_availability_in(item, myOutputParam_sts, myOutputParam_msg);
                        if (myOutputParam_sts.Value != null)
                        {
                            if (myOutputParam_sts.Value.ToString() == "E")
                            {
                                result.status   = "E";
                                result.message += (myOutputParam_msg.Value == null ? "" : myOutputParam_msg.Value.ToString());
                            }
                            else
                            {
                                context.sp_worklist_submit(userId, "1", "1", item, null);
                            }
                        }
                    }
                    foreach (var item in value.select_car_list)
                    {
                        context.sp_bookcar_availability_in(item, myOutputParam_sts, myOutputParam_msg);
                        if (myOutputParam_sts.Value != null)
                        {
                            if (myOutputParam_sts.Value.ToString() == "E")
                            {
                                result.status   = "E";
                                result.message += (myOutputParam_msg.Value == null ? "" : myOutputParam_msg.Value.ToString());
                            }
                            else
                            {
                                context.sp_worklist_submit(userId, "1", "2", item, null);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result.status  = "E";
                result.message = ex.Message.ToString();
            }

            return(result);
        }