protected void Page_Init(object sender, EventArgs e)
    {
        ctx = new AriClinicContext("AriClinicContext");
        // security control, it must be a user logged
        if (Session["User"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "channel"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        //
        if (Request.QueryString["ChannelId"] != null)
        {
            channelId = Int32.Parse(Request.QueryString["ChannelId"]);
            chn       = CntAriCli.GetChannel(channelId, ctx);
            LoadData(chn);
        }
    }
 protected void UnloadData(Replay chn)
 {
     // creating / editing reply
     replay.ReplayDate = (DateTime)rdtReplayDate.SelectedDate;
     if (rdcChannel.SelectedValue != "")
     {
         replay.Channel = CntAriCli.GetChannel(int.Parse(rdcChannel.SelectedValue), ctx);
     }
     if (rdcService.SelectedValue != "")
     {
         replay.Service = CntAriCli.GetService(int.Parse(rdcService.SelectedValue), ctx);
     }
     replay.Comments = txtComments.Text;
     replay.User     = user;
     // changing request accordingly
     request.Status = "CONTESTADA";
     replay.Request = request;
 }
Exemple #3
0
 protected void UnloadData(Request chn)
 {
     req.RequestDateTime = (DateTime)rdtRequestDateTime.SelectedDate;
     req.Status          = txtStatus.Text;
     if (rdcCampaign.SelectedValue != "")
     {
         req.Campaign = CntAriCli.GetCampaign(int.Parse(rdcCampaign.SelectedValue), ctx);
     }
     if (rdcChannel.SelectedValue != "")
     {
         req.Channel = CntAriCli.GetChannel(int.Parse(rdcChannel.SelectedValue), ctx);
     }
     if (rdcSource.SelectedValue != "")
     {
         req.Source = CntAriCli.GetSource(int.Parse(rdcSource.SelectedValue), ctx);
     }
     if (rdcPatient.SelectedValue != "")
     {
         req.Patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx);
     }
     if (rdcClinic.SelectedValue != "")
     {
         req.Clinic = CntAriCli.GetClinic(int.Parse(rdcClinic.SelectedValue), ctx);
     }
     req.Surname1 = txtSurname1.Text;
     req.Surname2 = txtSurname2.Text;
     req.Name     = txtName.Text;
     req.Sex      = rdcbSex.SelectedValue;
     if (rdtBornDate.SelectedDate != null)
     {
         req.BornDate = (DateTime)rdtBornDate.SelectedDate;
     }
     req.PostalCode = txtCodPostal.Text;
     req.Dni        = txtDni.Text;
     req.Email      = txtEmail.Text;
     req.Telephone  = txtTelephone.Text;
     if (rdcService.SelectedValue != "")
     {
         req.Service = CntAriCli.GetService(int.Parse(rdcService.SelectedValue), ctx);
     }
     req.Comments = txtComments.Text;
     req.FullName = String.Format("{0} {1}, {2}", req.Surname1, req.Surname2, req.Name);
     req.User     = user;
 }
 protected bool CreateChange()
 {
     if (!DataOk())
     {
         return(false);
     }
     if (chn == null)
     {
         chn = new Channel();
         UnloadData(chn);
         ctx.Add(chn);
     }
     else
     {
         chn = CntAriCli.GetChannel(channelId, ctx);
         UnloadData(chn);
     }
     ctx.SaveChanges();
     return(true);
 }