Exemplo n.º 1
0
        public bool SaveZone(mdlVendorEmployee ObjmdlVendorEmployee, DataTable dt, string SaveUpdate)
        {
            if (Con.State == ConnectionState.Open)
            {
                Con.Close();
            }
            SqlTransaction transaction;
            Con.Open();
            transaction = Con.BeginTransaction();
            bool Save = false;
            try
            {
                SqlCommand cmd = new SqlCommand("stp_ERP_VendorEmployee_Crud", Con, transaction);

                cmd.Parameters.Add("@pk_SPOId", SqlDbType.VarChar, 6).Value = ObjmdlVendorEmployee.pk_SPOId;
                cmd.Parameters.Add("@SPOName", SqlDbType.VarChar, 50).Value = ObjmdlVendorEmployee.SPOName;
                cmd.Parameters.Add("@CompanyId", SqlDbType.VarChar, 3).Value = ObjmdlVendorEmployee.CompanyId;
                cmd.Parameters.Add("@GroupId", SqlDbType.VarChar, 6).Value = ObjmdlVendorEmployee.GroupId;
                cmd.Parameters.Add("@ManagerId", SqlDbType.VarChar, 6).Value = ObjmdlVendorEmployee.ManagerId;
                cmd.Parameters.Add("@Remarks", SqlDbType.VarChar, 100).Value = ObjmdlVendorEmployee.Remarks;
                cmd.Parameters.Add("@chkMerck", SqlDbType.Bit).Value = Convert.ToBoolean(ObjmdlVendorEmployee.chkMerck);
                cmd.Parameters.Add("@Discontinue", SqlDbType.Bit).Value = Convert.ToBoolean(ObjmdlVendorEmployee.Discontinue);
                cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = ObjmdlVendorEmployee.AddUser;
                if (SaveUpdate == "Save")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 7).Value = "Save";
                    cmd.Parameters.Add("@Option", SqlDbType.VarChar, 20).Value = "ISPO";
                }
                if (SaveUpdate == "Update")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 7).Value = "Update";
                    cmd.Parameters.Add("@Option", SqlDbType.VarChar, 20).Value = "USPO";
                }
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                Save = true;

                if (SaveDetailZone(dt, transaction, ObjmdlVendorEmployee.pk_SPOId))
                {
                    transaction.Commit();
                    Save = true;
                }
                else
                {
                    Save = false;
                }
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }

            }
            catch (Exception ex)
            {
                try
                {
                    transaction.Rollback();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Save = false;
                    if (Con.State == ConnectionState.Open)
                    {
                        Con.Close();
                    }
                }
                Save = false;
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
                MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return Save;
        }
Exemplo n.º 2
0
        public bool SaveUpdatePatient(mdlVendorEmployee ObjmdlVendorEmployee, string SaveUpdate)
        {
            bool Save = false;
            try
            {
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
                SqlCommand cmd = new SqlCommand("stp_ERP_VendorEmployee_Crud", Con);

                cmd.Parameters.Add("@pk_PatientId", SqlDbType.VarChar, 6).Value = ObjmdlVendorEmployee.pk_PatientId;
                cmd.Parameters.Add("@PatientName", SqlDbType.VarChar, 30).Value = ObjmdlVendorEmployee.PatientName;
                cmd.Parameters.Add("@DiscontinuedPatient", SqlDbType.Bit).Value = ObjmdlVendorEmployee.DiscontinuePatient;
                cmd.Parameters.Add("@DoctorName", SqlDbType.VarChar, 30).Value = ObjmdlVendorEmployee.DoctorName;
                cmd.Parameters.Add("@Address", SqlDbType.VarChar, 50).Value = ObjmdlVendorEmployee.Address;
                cmd.Parameters.Add("@CoPatientId", SqlDbType.VarChar, 20).Value = ObjmdlVendorEmployee.CoPatientId;
                cmd.Parameters.Add("@PhoneNo", SqlDbType.VarChar, 15).Value = ObjmdlVendorEmployee.PhoneNo;
                cmd.Parameters.Add("@CellNo", SqlDbType.VarChar, 15).Value = ObjmdlVendorEmployee.CellNo;
                cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 20).Value = ObjmdlVendorEmployee.AddUser;

                if (SaveUpdate == "Save")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 7).Value = "Save";
                    cmd.Parameters.Add("@Option", SqlDbType.VarChar, 20).Value = "SPatientR";
                }
                if (SaveUpdate == "Update")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 7).Value = "Update";
                    cmd.Parameters.Add("@Option", SqlDbType.VarChar, 20).Value = "UPR";
                }
                Con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                Save = true;
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Save = false;
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }

            return Save;
        }
Exemplo n.º 3
0
 public bool SaveUpdatePatient(mdlVendorEmployee ObjmdlVendorEmployee, string SaveUpdate)
 {
     return ObjdalVendorEmployee.SaveUpdatePatient(ObjmdlVendorEmployee, SaveUpdate);
 }
Exemplo n.º 4
0
 public bool SaveZones(mdlVendorEmployee ObjmdlVendorEmployee, DataTable dt, string SaveUpdate)
 {
     return ObjdalVendorEmployee.SaveZone(ObjmdlVendorEmployee, dt, SaveUpdate);
 }
Exemplo n.º 5
0
 public bool SaveUpdateManager(mdlVendorEmployee ObjmdlVendorEmployee, string SaveUpdate)
 {
     return ObjdalVendorEmployee.SaveUpdateManager(ObjmdlVendorEmployee, SaveUpdate);
 }