示例#1
0
        private void save_data()
        {
            try
            {
                List <LabDynamicControl> lstCtrl = new List <LabDynamicControl>();
                foreach (Control c in panel4.Controls)
                {
                    foreach (Control ctrl in c.Controls)
                    {
                        LabDynamicControl obj = new LabDynamicControl();
                        obj.ctrlName  = ctrl.Name;
                        obj.ctrlValue = ctrl.Text;
                        lstCtrl.Add(obj);
                    }
                }
                int flag   = 0;
                int iSaved = 0;
                //Save Lab Test Result
                ComArugments args = new ComArugments();
                args.ParamList[clsLabCommon.Laboratory.TestResultEntry.ResultEntryId]    = ResultEntryId;
                args.ParamList[clsLabCommon.Laboratory.TestResultEntry.BillId]           = BillId;
                args.ParamList[clsLabCommon.Laboratory.TestResultEntry.ReceivedDateTime] = dtpReceivedDateTime.Value;
                args.ParamList[clsLabCommon.Laboratory.TestResultEntry.ReportedDateTime] = dtpReportedDateTime.Value;
                if (ResultEntryId == 0)
                {
                    ResultEntryId = objBusiness.SaveResultEntryInfo(args);
                }
                else
                {
                    iSaved = objBusiness.SaveResultEntryInfo(args);
                }
                //Delete all the entries in Test_Result_Entry Table and Save the Details
                int iDeleted = objBusiness.DeletePatientResultEntry(ResultEntryId);
                foreach (DataRow row in dtResultEntry.Rows)
                {
                    LabDynamicControl obj         = lstCtrl.Find(ctrl => ctrl.ctrlName.Equals("txt" + row["test_field_id"].ToString() + "_" + row["investigation_id"].ToString()));
                    string            resultValue = string.Empty;
                    if (obj != null)
                    {
                        resultValue = obj.ctrlValue;
                    }

                    ComArugments argsDetail = new ComArugments();
                    argsDetail.ParamList[clsLabCommon.Laboratory.TestResultEntry.ResultEntryId]   = ResultEntryId;
                    argsDetail.ParamList[clsLabCommon.Laboratory.TestResultEntry.InvestigationId] = row["investigation_id"].ToString();
                    argsDetail.ParamList[clsLabCommon.Laboratory.TestResultEntry.TestFieldId]     = row["test_field_id"].ToString();
                    //argsDetail.ParamList[clsLabCommon.Laboratory.TestResultEntry.ResultValue] = resultValue;
                    argsDetail.ParamList[clsLabCommon.Laboratory.TestResultEntry.ResultValue] = resultValue.Replace("'", "''");
                    flag = objBusiness.SaveResultEntryDetailInfo(argsDetail);
                }
                objBusiness.commitTransction();
                if (flag > 0)
                {
                    MessageBox.Show("Result Entry is saved", "Result Entry", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Result Entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
                objBusiness.rollBackTransation();
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvUserActivities.Rows.Count > 0)
                {
                    int count = 0;
                    DataGridViewCheckBoxCell ch = new DataGridViewCheckBoxCell();
                    foreach (DataGridViewRow row in dgvUserActivities.Rows)
                    {
                        ch = (DataGridViewCheckBoxCell)row.Cells[3];

                        if (ch.Value == null)
                        {
                            ch.Value = false;
                        }
                        switch (ch.Value.ToString())
                        {
                        case "1":     //Selected User Activity
                        {
                            count++;
                            break;
                        }

                        case "0":
                        {
                            if (row.Cells["Activity"].Value.ToString() == "User Rights")
                            {
                                if (cboUser.Text == "Admin")
                                {
                                    MessageBox.Show("Please select User rights Activity!", "Map User Activity", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    return;
                                }
                            }
                            break;
                        }
                        }
                    }
                    if (count > 0)
                    {
                        int iDeleted = objBusiness.DeleteUserRoleActities(Convert.ToInt32(cboUser.SelectedValue));
                        int iSaved   = 0;

                        DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell();
                        foreach (DataGridViewRow row in dgvUserActivities.Rows)
                        {
                            ch1 = (DataGridViewCheckBoxCell)row.Cells[3];

                            if (ch1.Value == null)
                            {
                                ch1.Value = false;
                            }
                            switch (ch1.Value.ToString())
                            {
                            case "1":     //Selected User Activity
                            {
                                ComArugments args = new ComArugments();
                                args.ParamList[CIS.Common.User.UserMapRoleAction.RoleId]   = cboUser.SelectedValue;
                                args.ParamList[CIS.Common.User.UserMapRoleAction.ActionId] = row.Cells["action_id"].Value.ToString();
                                iSaved = objBusiness.SaveUserRoleActivity(args);
                                break;
                            }
                            }
                            //if (Convert.ToInt32(row.Cells[3].Value.ToString()) == 1)
                        }
                        if (iSaved > 0)
                        {
                            MessageBox.Show("Activities are mapped successfully", "Map User Activity", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        objBusiness.commitTransction();
                    }
                    else
                    {
                        MessageBox.Show("Activities are not selected!", "Map User Activity", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                objBusiness.rollBackTransation();
                MessageBox.Show(ex.Message);
            }
        }