コード例 #1
0
        protected void btnsbmit_Click(object sender, EventArgs e)
        {
            usp_NotificationMessagesInsertProcedure_Result notificationRecord = null;
            usp_ComplaintsUpdateProcedure_Result           complaintResult    = null;

            using (TransactionScope tx = new TransactionScope())
            {
                using (Entities1 db = new Entities1())
                {
                    int    id     = Convert.ToInt32(Request.QueryString["Id"].ToString());
                    string userId = User.Identity.GetUserId().ToString();
                    var    x      =
                        db.usp_ComplaintsUpdateProcedure(
                            id,
                            Convert.ToInt32(drpapartmentnumber.Value),
                            Convert.ToInt32(drplvl1.Value),
                            Convert.ToInt32(drplvl2.Value),
                            Convert.ToInt32(drplvl3.SelectedItem.Value),
                            Convert.ToDateTime(txtfixdatetime.Text),
                            DateTime.Now,
                            Convert.ToInt32(drppaint.SelectedValue),
                            (int)ComplaintStatusEnum.Completed,
                            Convert.ToInt32(drpissue.Value),
                            txttechname.Text,
                            userId,
                            memonotes.Text,
                            txtsubject.Text
                            , txtSearch.Text
                            , txtphone.Text
                            , txtcustomername.Text
                            , Convert.ToInt32(drpownertype.SelectedItem.Value)
                            , txtother.Text
                            , drpotheap.Text
                            );
                    complaintResult = x.FirstOrDefault();
                    resultmessage.Attributes["class"] = "alert-success";
                    lbltxtresult.Text = "تم الانتهاء من العمل في البلاغ";
                    btnedit.Visible   = false;
                    DataBind();
                    string messageText = string.Format(Utilities.GetDescription(NotificationMessagesEnum.ComplaintClosure), complaintResult.ID.ToString("9260000000"), ConfigurationManager.AppSettings["WebServerIP"] + "/Evaluation/TechnictionEvaluation?ID=" + complaintResult.ID);
                    ObjectResult <usp_NotificationMessagesInsertProcedure_Result> y =
                        db.usp_NotificationMessagesInsertProcedure(
                            "966" + complaintResult.Phone.TrimStart('0'),
                            complaintResult.ID.ToString("9260000000"),
                            messageText,
                            null,
                            1,
                            1,
                            DateTime.Now
                            );
                    notificationRecord = y.FirstOrDefault();
                }
                tx.Complete();
            }
            Utilities.SendSMS(notificationRecord.MobileNumber, notificationRecord.MessageText, notificationRecord.ID);
        }
コード例 #2
0
        protected void btnsbmit_Click(object sender, EventArgs e)
        {
            try
            {
                usp_NotificationMessagesInsertProcedure_Result notificationRecord = null;
                usp_ComplaintsInsert_Result complaintResult = null;
                using (TransactionScope tx = new TransactionScope())
                {
                    using (Entities1 db = new Entities1())
                    {
                        ObjectResult <usp_ComplaintsInsert_Result> x =
                            db.usp_ComplaintsInsert(
                                Convert.ToInt16(drpapartmentnumber.Value),
                                Convert.ToInt16(drplvl1.Value),
                                Convert.ToInt16(drplvl2.Value),
                                Convert.ToInt16(drplvl3.SelectedItem.Value),
                                Convert.ToDateTime(txtfixdatetime.Text),
                                DateTime.Now,
                                null,
                                (int)ComplaintStatusEnum.Created,
                                null,
                                null,
                                User.Identity.GetUserId(),
                                memonotes.Text,
                                txtsubject.Text
                                , txtSearch.Text
                                , txtphone.Text
                                , txtcustomername.Text
                                , Convert.ToInt16(drpownertype.SelectedItem.Value)
                                , txtother.Text
                                );

                        complaintResult = x.FirstOrDefault();

                        btnprint.CommandArgument          = complaintResult.ID.ToString();
                        btnnew.Visible                    = true;
                        btnprint.Visible                  = true;
                        btnsumnit.Visible                 = false;
                        resultmessage.Attributes["class"] = "alert-success";
                        displayID.Value                   = "true";
                        txtID.Text           = "926/" + complaintResult.ID.ToString("0000000");
                        txtCreationDate.Text = complaintResult.CreateDateTime.ToString();
                        lbltxtresult.Text    = "تم اضافة البلاغ بنجاح";
                        string messageText = string.Format(Utilities.GetDescription(NotificationMessagesEnum.ComplaintCreationSMS), complaintResult.ID.ToString("9260000000"), complaintResult.CreateDateTime.Value.ToString("dd/MM/yyyy"));
                        ObjectResult <usp_NotificationMessagesInsertProcedure_Result> y =
                            db.usp_NotificationMessagesInsertProcedure(
                                "966" + complaintResult.Phone.TrimStart('0'),
                                complaintResult.ID.ToString("9260000000"),
                                messageText,
                                null,
                                1,
                                1,
                                DateTime.Now
                                );
                        notificationRecord = y.FirstOrDefault();
                    }
                    tx.Complete();
                }
                string message = string.Format(Utilities.GetDescription(NotificationMessagesEnum.ComplaintCreationSMS), complaintResult.ID.ToString("9260000000"), complaintResult.CreateDateTime.Value.ToString("dd/MM/yyyy"));
                Utilities.SendSMS(notificationRecord.MobileNumber, message, notificationRecord.ID);
            }
            catch (Exception exception)
            {
                Log.Error(exception.StackTrace);
                throw new Exception("خطاء اثناء تنفيذ العملية !");
            }
        }